forked from derpibooru/philomena
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Dockerfile.web
52 lines (42 loc) · 1.71 KB
/
Dockerfile.web
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
FROM elixir:1.10.3
RUN apt-get update \
&& apt-get -qq -y install apt-transport-https \
&& echo "deb https://deb.nodesource.com/node_12.x stretch main" >> /etc/apt/sources.list \
&& wget -qO - "https://deb.nodesource.com/gpgkey/nodesource.gpg.key" | apt-key add - \
&& apt-get update \
&& apt-get -qq -y install inotify-tools build-essential git ffmpeg libavformat-dev libavcodec-dev libswscale-dev nodejs libmagic-dev libpng-dev gifsicle optipng libjpeg-progs librsvg2-bin
ADD https://s3.amazonaws.com/rebar3/rebar3 /usr/local/bin/rebar3
RUN chmod +x /usr/local/bin/rebar3
COPY docker/app/safe-rsvg-convert /usr/local/bin/safe-rsvg-convert
ENV MIX_ENV=prod
WORKDIR /srv/
RUN useradd -d /srv/ -r -s /bin/nologin -u 200 -U philomena
RUN chown philomena:philomena /srv/
USER 200
COPY --chown=200:200 ./mix.exs /srv/philomena/mix.exs
COPY --chown=200:200 ./mix.lock /srv/philomena/mix.lock
COPY --chown=200:200 ./assets/package.json /srv/philomena/assets/package.json
COPY --chown=200:200 ./assets/package-lock.json /srv/philomena/assets/package-lock.json
RUN mix local.hex --force && \
mix local.rebar --force
WORKDIR /srv/philomena/assets
RUN npm install
WORKDIR /srv/philomena
RUN mix deps.get
RUN mix deps.compile
COPY --chown=200:200 . /srv/philomena
WORKDIR /srv/philomena/assets
RUN npm run deploy
WORKDIR /srv/philomena
RUN mix compile
RUN mix phx.digest
RUN mix release
FROM nginx:1.18.0-alpine-perl
ENV APP_HOST=app.derpibooru-legacy.svc.cluster.local
COPY docker/web/site.conf /etc/nginx/conf.d/default.conf
COPY docker/web/nginx.conf /etc/nginx/nginx.conf
COPY --from=0 /srv/philomena/priv/static /srv/assets/static
EXPOSE 8080
RUN chown -R 200:200 /srv/assets/static
USER 200
CMD nginx -g 'daemon off;'