-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile.prod
73 lines (64 loc) · 1.59 KB
/
Dockerfile.prod
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# --- Common stuff:
FROM ruby:3.1.4-alpine3.18 AS common_builder
ENV BUNDLER_VERSION=2.4.15 \
INSTALL_PATH=/app
RUN mkdir -p $INSTALL_PATH
RUN apk add --update --no-cache \
binutils-gold \
build-base \
curl \
file \
g++ \
gcc \
git \
less \
libstdc++ \
libffi-dev \
libc-dev \
linux-headers \
libxml2-dev \
libxslt-dev \
libgcrypt-dev \
make \
mariadb-client \
mariadb-dev \
netcat-openbsd \
nodejs \
openssl \
pkgconfig \
shared-mime-info \
tzdata \
yarn
# Run as a specific user: (WIP: yarn requires more privileges)
# ARG USER_ID
# ARG GROUP_ID
# RUN addgroup -g $GROUP_ID -S dev
# RUN adduser -D -g '' -u $USER_ID -G dev dev
# RUN chown -R dev:dev $INSTALL_PATH
# USER $USER_ID
# App image:
RUN gem install bundler -v $BUNDLER_VERSION
# --- Image-specific stuff:
FROM common_builder
ENV RAILS_ENV=production \
DATABASE_NAME=goggles \
DATABASE_HOST=goggles-db \
DATABASE_PORT=3306 \
DATABASE_USER=root \
DISABLE_SPRING=true
# Current export defaults:
# BUNDLE_APP_CONFIG='/usr/local/bundle'
# BUNDLE_PATH='/usr/local/bundle'
# GEM_HOME='/usr/local/bundle'
WORKDIR $INSTALL_PATH
COPY . ./
RUN bundle config build.nokogiri --use-system-libraries
COPY ./config/database.docker.yml ./config/database.yml
RUN bundle check || bundle install
RUN yarn install --check-files
# Keep the version argument at the end to avoid early cache miss during builds:
ARG TAG
ENV TAG=${TAG:-latest}
RUN echo "Version: $TAG"
LABEL AUTHOR=steve.alloro@gmail.com VERSION=$TAG
ENTRYPOINT ["./entrypoints/docker.prod.sh"]