-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathDockerfile
57 lines (41 loc) · 981 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
53
54
55
56
57
FROM elixir:1.9.4-alpine as mixer
ENV LANG=C.UTF-8
ENV MIX_ENV=prod
# Install needed packages
RUN apk update && apk add nodejs npm
RUN mkdir /app
WORKDIR /app
RUN mix local.hex --force
RUN mix local.rebar --force
# install dependencies
COPY mix.exs mix.lock ./
RUN mix deps.get
# install npm dependencies
COPY assets/package.json assets/package-lock.json ./assets/
RUN cd assets && npm install
# build assets
COPY assets ./assets/
RUN cd assets && npm run deploy
# copy only needed files
COPY config ./config/
COPY lib ./lib/
COPY priv ./priv/
# compile
RUN mix do compile
RUN mix phx.digest
# make release
RUN mkdir /rel
RUN mix release --path /rel
FROM alpine
ENV LANG=C.UTF-8
# Install openssl
RUN apk update && apk add openssl ncurses-libs
ENV MIX_ENV=prod
ENV PORT=4000
RUN mkdir /app
WORKDIR /app
# copy the release folder from the previous build
COPY --from=mixer /rel ./
RUN chown -R nobody: ./
EXPOSE ${PORT}
ENTRYPOINT ["./bin/hello_world_ci", "start"]