-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathDockerfile
52 lines (34 loc) · 1003 Bytes
/
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
# Alias this container as builder:
FROM bitwalker/alpine-elixir-phoenix as builder
WORKDIR /paraguas
ENV MIX_ENV=prod
# Umbrella
COPY mix.exs mix.lock ./
COPY config config
# Apps
COPY apps apps
RUN mix do deps.get, deps.compile
# Build assets in production mode:
WORKDIR /paraguas/apps/phoenix_app/assets
RUN npm install && ./node_modules/brunch/bin/brunch build --production
WORKDIR /paraguas/apps/phoenix_app
RUN MIX_ENV=prod mix phx.digest
WORKDIR /paraguas
COPY rel rel
RUN mix release --env=prod --verbose
### Release
FROM alpine:3.6
RUN apk upgrade --no-cache && \
apk add --no-cache bash openssl
# we need bash and openssl for Phoenix
EXPOSE 4000
ENV PORT=4000 \
MIX_ENV=prod \
REPLACE_OS_VARS=true \
SHELL=/bin/bash
WORKDIR /paraguas
COPY --from=builder /paraguas/_build/prod/rel/paraguas/releases/0.1.0/paraguas.tar.gz .
RUN tar zxf paraguas.tar.gz && rm paraguas.tar.gz
RUN chown -R root ./releases
USER root
CMD ["/paraguas/bin/paraguas", "foreground"]