-
Notifications
You must be signed in to change notification settings - Fork 110
/
Dockerfile
66 lines (43 loc) · 1.66 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
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
# Build for musl-libc, not glibc (see https://github.com/sparklemotion/nokogiri/issues/2075, https://github.com/rubygems/rubygems/issues/3174)
ENV BUNDLE_FORCE_RUBY_PLATFORM 1
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
WORKDIR /app
COPY Gemfile* /app/
RUN bundle config --local without 'development test' \
&& bundle install -j4 --retry 3 \
&& 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
WORKDIR /app
EXPOSE 3000
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"]