-
-
Notifications
You must be signed in to change notification settings - Fork 63
/
Dockerfile
73 lines (60 loc) · 1.5 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
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
# syntax=docker/dockerfile:1
# Base image
FROM ruby:3.3.6-alpine as base
ENV BUNDLE_WITHOUT="development:test" \
BUNDLE_PATH="/usr/local/bundle" \
BUNDLE_DEPLOYMENT="1" \
RAILS_ENV="production"
# Build stage
FROM base as build
WORKDIR /app
COPY ./Gemfile /app/Gemfile
COPY ./Gemfile.lock /app/Gemfile.lock
RUN apk add --no-cache \
git \
bash \
build-base \
libxml2-dev \
libxslt-dev \
tzdata \
openssl \
postgresql-dev \
libc6-compat && \
bundle config --global without "${BUNDLE_WITHOUT}" && \
bundle config --global path "${BUNDLE_PATH}" && \
bundle config --global deployment "${BUNDLE_DEPLOYMENT}" && \
bundle config --global retry 5 && \
bundle install && \
find /usr/local/bundle/ \
\( \
-name "*.c" -o \
-name "*.o" -o \
-name "*.a" -o \
-name "*.h" -o \
-name "Makefile" -o \
-name "*.md" \
\) -delete && \
chmod -R a+r "${BUNDLE_PATH}"
# Final stage
FROM base
LABEL maintainer="keygen.sh <oss@keygen.sh>"
RUN apk add --no-cache \
bash \
postgresql-client \
tzdata \
libc6-compat && \
adduser -h /app -g keygen -u 1000 -s /bin/bash -D keygen
COPY --from=build --chown=keygen:keygen \
/usr/local/bundle/ /usr/local/bundle
WORKDIR /app
COPY . /app
RUN chmod +x /app/scripts/entrypoint.sh && \
chown -R keygen:keygen /app
ENV KEYGEN_EDITION="CE" \
KEYGEN_MODE="singleplayer" \
RAILS_LOG_TO_STDOUT="1" \
PORT="3000" \
BIND="0.0.0.0"
USER keygen
ENTRYPOINT ["/app/scripts/entrypoint.sh"]
CMD ["web"]