This repository has been archived by the owner on Nov 22, 2022. It is now read-only.
generated from zestcreative/petal
-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
71 lines (54 loc) · 1.84 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
## SYSTEM
FROM hexpm/elixir:1.11.3-erlang-23.2.4-ubuntu-focal-20201008 AS builder
ENV LANG=C.UTF-8 \
LANGUAGE=C:en \
LC_ALL=C.UTF-8 \
DEBIAN_FRONTEND=noninteractive \
TERM=xterm \
MIX_ENV=prod \
REFRESH_AT=20210314
RUN apt-get update && apt-get install -y \
git expat libxml2-dev pkg-config libasound2-dev libssl-dev cmake \
libfreetype6-dev libexpat1-dev libxcb-composite0-dev curl python3
WORKDIR /tmp
RUN curl https://sh.rustup.rs -sSf > rustup.sh && \
chmod 755 rustup.sh && \
./rustup.sh -y && \
rm /tmp/rustup.sh
RUN ~/.cargo/bin/cargo install silicon
ARG USER_ID
ARG GROUP_ID
RUN groupadd --gid $GROUP_ID user && \
useradd -m --gid $GROUP_ID --uid $USER_ID user
USER user
RUN mkdir /home/user/app
WORKDIR /home/user/app
RUN mix local.rebar --force && \
mix local.hex --if-missing --force
COPY --chown=user:user mix.* ./
COPY --chown=user:user config ./config
COPY --chown=user:user VERSION .
RUN mix do deps.get, deps.compile
## FRONTEND
FROM node:14.14.0-alpine AS frontend
RUN mkdir -p /home/user/app
WORKDIR /home/user/app
# PurgeCSS needs to see the Elixir stuff
COPY lib ./lib
COPY assets/package.json assets/package-lock.json ./assets/
COPY --from=builder /home/user/app/deps/phoenix ./deps/phoenix
COPY --from=builder /home/user/app/deps/phoenix_html ./deps/phoenix_html
COPY --from=builder /home/user/app/deps/phoenix_live_view ./deps/phoenix_live_view
RUN npm --prefix ./assets ci --progress=false --no-audit --loglevel=error
COPY assets ./assets
RUN npm --prefix ./assets run deploy
## APP
FROM builder AS app
USER user
COPY --from=frontend --chown=user:user /home/user/app/priv/static ./priv/static
COPY --chown=user:user lib ./lib
COPY --chown=user:user rel ./rel
COPY --chown=user:user priv/gettext ./priv/gettext
COPY --chown=user:user priv/repo ./priv/repo
RUN mix phx.digest
CMD ["/bin/bash"]