forked from enterprise-oss/sinatra-ruby-idp
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
50 lines (41 loc) · 1.25 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
FROM ruby:3.1.2-alpine AS builder
RUN apk add --no-cache nodejs npm bash curl musl-dev libc-dev make gcc sqlite-dev gcompat
ENV APP_DIR=/app
RUN mkdir ${APP_DIR}
WORKDIR ${APP_DIR}
ARG GITHUB_USERNAME
ARG GITHUB_PACKAGES_TOKEN
COPY build.js ./
COPY react-shim.js ./
COPY Gemfile Gemfile.lock ./
COPY package.json package-lock.json ./
RUN bundle config --local path ${APP_DIR}/vendor/bundle && bundle install --jobs 8
RUN npm install
COPY public/ ./public/
COPY lib/ ./lib/
COPY app.rb .
COPY src/ ./src/
RUN npm run build
COPY config.ru .
COPY views/ ./views
COPY scripts/entrypoint.sh ./
RUN adduser -h ${APP_DIR} -s /bin/false -D app_user
RUN chown -R app_user:app_user ${APP_DIR}
USER app_user
FROM ruby:3.1.2-alpine
RUN apk add --no-cache sqlite-dev gcompat
RUN mkdir /app
WORKDIR /app
COPY --from=builder /app/public/ ./public
COPY --from=builder /app/app.rb .
COPY --from=builder /app/config.ru .
COPY --from=builder /app/entrypoint.sh /app
COPY --from=builder /app/views ./views
COPY --from=builder /app/lib ./lib
COPY --from=builder /app/vendor ./vendor
COPY --from=builder /app/Gemfile .
RUN bundle config --local path /app/vendor/bundle
CMD [ "/app/entrypoint.sh" ]
RUN adduser -h /app -s /bin/false -D app_user
RUN chown -R app_user:app_user /app
USER app_user