-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
64 lines (46 loc) · 1.34 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
#
# Pull mix dependencies to have phoenix
# packages available for yarn install
################################################
FROM elixir:alpine as deps
RUN mkdir /app
WORKDIR /app
COPY mix.exs mix.lock ./
RUN MIX_ENV=prod mix do local.hex --force, deps.get
#
# Install yarn dependencies and build
# production js
################################################
FROM node:11.15.0-alpine as assets-build
RUN apk --no-cache add python make g++
RUN mkdir /app
WORKDIR /app
COPY assets/ ./assets
COPY --from=deps app/deps/ ./deps
RUN cd assets && yarn && yarn build
#
# Build distillery release
################################################
FROM elixir:alpine as release
RUN mkdir /app
WORKDIR /app
COPY --from=deps app/deps/ ./deps
COPY --from=assets-build app/priv/static/ ./priv/static
COPY . .
RUN MIX_ENV=prod mix do local.hex --force, \
local.rebar --force, \
phx.digest, \
distillery.release --verbose --no-tar
#
# RUN distillery release on minial alpine
################################################
FROM alpine
RUN apk add --no-cache ncurses-libs openssl bash
COPY --from=release /app/_build/prod/rel/lib_ten/ /app
ENV REPLACE_OS_VARS=true
ENV APP_NAME=lib_ten
ENV APP_VERSION=0.0.1
ENV PORT 80
VOLUME /app/uploads
ENTRYPOINT ["/app/bin/lib_ten"]
CMD ["foreground"]