-
Notifications
You must be signed in to change notification settings - Fork 110
/
Dockerfile
65 lines (43 loc) · 1.57 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
FROM node:20.11.0-alpine AS node
FROM ruby:3.3.1-alpine AS base
FROM base AS builder
ENV RAILS_ENV production
ENV NODE_ENV production
COPY --from=node /usr/local/bin/node /usr/local/bin/node
COPY --from=node /usr/local/lib/node_modules /usr/local/lib/node_modules
RUN ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm
RUN apk add --no-cache tzdata libpq-dev build-base gcompat
WORKDIR /app
COPY Gemfile* /app/
RUN bundle config --local without 'development test' \
&& bundle install -j4 --retry 3 \
&& bundle exec bootsnap precompile --gemfile app/ lib/ \
&& bundle clean --force \
&& rm -rf /usr/local/bundle/cache \
&& find /usr/local/bundle/gems/ -name "*.c" -delete \
&& find /usr/local/bundle/gems/ -name "*.o" -delete
COPY . /app
RUN SECRET_KEY_BASE_DUMMY=1 bundle exec rails assets:precompile \
&& npm cache clean --force \
&& rm -rf node_modules tmp/cache/* /tmp/* package-lock.json log/production.log app/javascript/* app/assets/* storage/*
FROM base
ENV LANG C.UTF-8
ENV RAILS_ENV production
LABEL service="blackcandy"
RUN apk add --no-cache \
tzdata \
libpq \
vips \
ffmpeg \
curl \
gcompat
WORKDIR /app
EXPOSE 80
RUN addgroup -g 1000 -S app && adduser -u 1000 -S app -G app
COPY --from=builder --chown=app:app /usr/local/bundle/ /usr/local/bundle/
COPY --from=builder --chown=app:app /app/ /app/
# Forwards media listener logs to stdout so they can be captured in docker logs.
RUN ln -sf /dev/stdout /app/log/media_listener_production.log
USER app
ENTRYPOINT ["docker/entrypoint.sh"]
CMD ["docker/production_start.sh"]