-
Notifications
You must be signed in to change notification settings - Fork 39
/
Dockerfile
47 lines (37 loc) · 1.11 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# syntax = docker/dockerfile:1
FROM ruby:3.3.6-alpine
LABEL maintainer="[email protected]"
# Add basic packages
RUN apk add --no-cache \
jemalloc \
xz-libs \
postgresql-client \
gcompat \
brotli-libs \
tzdata \
file
# Configure Rails
ENV RAILS_LOG_TO_STDOUT=true
ENV RAILS_SERVE_STATIC_FILES=true
WORKDIR /app
# Expose Puma port
EXPOSE 3000
# This image is for production env only
ENV RAILS_ENV=production
# Enable jemalloc for reduced memory usage and latency
ENV LD_PRELOAD=/usr/lib/libjemalloc.so.2
# Write GIT meta data from arguments to env vars
ONBUILD ARG COMMIT_SHA
ONBUILD ARG COMMIT_TIME
ONBUILD ARG COMMIT_VERSION
ONBUILD ARG COMMIT_BRANCH
ONBUILD ENV COMMIT_SHA=${COMMIT_SHA}
ONBUILD ENV COMMIT_TIME=${COMMIT_TIME}
ONBUILD ENV COMMIT_VERSION=${COMMIT_VERSION}
ONBUILD ENV COMMIT_BRANCH=${COMMIT_BRANCH}
# Add user
ONBUILD RUN addgroup -g 1000 -S app && \
adduser -u 1000 -S app -G app
# Copy app with gems from former build stage
ONBUILD COPY --from=builder --chown=app:app /usr/local/bundle/ /usr/local/bundle/
ONBUILD COPY --from=builder --chown=app:app /app /app