-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
37 lines (34 loc) · 1.07 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
# Extend from the official Elixir image
FROM elixir:1.11.3-alpine
# Install required libraries on Alpine
# note: build-base required to run mix “make” for
# one of my dependecies (bcrypt)
RUN apk update && apk upgrade && \
apk add postgresql-client && \
apk add nodejs npm && \
apk add build-base && \
rm -rf /var/cache/apk/*
# Set environment to production
ENV MIX_ENV prod
# Install hex package manager and rebar
# By using --force, we don’t need to type “Y” to confirm the installation
RUN mix do local.hex --force, local.rebar --force
# Cache elixir dependecies and lock file
COPY mix.* ./
# Install and compile production dependecies
RUN mix do deps.get --only prod
RUN mix deps.compile
# Cache and install node packages and dependencies
COPY assets/package.json assets/
RUN cd assets && \
npm install
# Copy all application files
COPY . ./
# Run frontend build, compile, and digest assets
RUN cd assets/ && \
npm run deploy && \
cd - && \
mix do compile, phx.digest
# Run entrypoint.sh script
RUN chmod +x entrypoint.sh
CMD ["/entrypoint.sh"]