-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
71 lines (53 loc) · 1.61 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
# Set the Docker image you want to base your image off.
FROM elixir:1.10.2 as builder
ENV MIX_ENV="prod" \
PORT="5000"
# Add nodejs
RUN curl -sL https://deb.nodesource.com/setup_13.x | bash -
# Install other stable dependencies that don't change often
RUN apt-get update && \
apt-get install -y --no-install-recommends \
apt-utils nodejs postgresql-client && \
rm -rf /var/lib/apt/lists/*
WORKDIR /opt/app
# install hex + rebar
RUN mix local.hex --force && \
mix local.rebar --force
# install mix dependencies
COPY mix.exs mix.lock ./
COPY config config
RUN mix deps.get
RUN mix deps.compile
# build assets
COPY assets assets
RUN cd assets && npm install && npm run deploy
RUN mix phx.digest
# build project
COPY priv priv
COPY lib lib
RUN mix compile
# build release
COPY rel rel
RUN mix release
FROM debian:buster-slim
RUN apt-get -qq update
RUN apt-get -qq install -y locales locales-all
# Set LOCALE to UTF8
RUN locale-gen en_US.UTF-8
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'
ENV MIX_ENV="prod" \
PORT="5000"
# Exposes this port from the docker container to the host machine
EXPOSE 5000
# Because these dirs were stripped from the slim package and
# caused issues installing postgres-client
RUN seq 1 8 | xargs -I{} mkdir -p /usr/share/man/man{}
# Install other stable dependencies that don't change often
RUN apt-get update && \
apt-get install -y --no-install-recommends \
postgresql-client && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=builder /opt/app/_build/prod/rel/nightingale ./
# The command to run when this image starts up
CMD ["./bin/nightingale", "start"]