-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
59 lines (47 loc) · 1.47 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
FROM elixir:1.5-slim
RUN apt-get update && apt-get -y install \
git make g++ wget curl build-essential locales python \
mysql-client \
imagemagick \
# for wkhtmltopdf
xvfb libxrender1 xfonts-utils xfonts-base xfonts-75dpi \
libfontenc1 x11-common xfonts-encodings libxfont1 \
ttf-freefont fontconfig dbus && \
curl -sL https://deb.nodesource.com/setup_8.x | bash && \
apt-get -y install nodejs && \
rm -rf /var/lib/apt/lists/*
# Set the locale
RUN locale-gen en_US.UTF-8 && \
localedef -i en_US -f UTF-8 en_US.UTF-8 && \
update-locale LANG=en_US.UTF-8
ENV LANG=en_US.UTF-8 \
LANGUAGE=en_US:en \
LC_ALL=en_US.UTF-8
RUN \
mkdir -p /opt/app && \
chmod -R 777 /opt/app && \
update-ca-certificates --fresh
# Add local node module binaries to PATH
ENV PATH=./node_modules/.bin:$PATH \
HOME=/opt/app
WORKDIR /opt/app
# Install Hex+Rebar
RUN mix local.hex --force && \
mix local.rebar --force
# Set exposed ports
EXPOSE 4000
ENV PORT=4000 MIX_ENV=prod
# Install deps
# Install do mix first -> phoenix is imported by package.json
COPY mix.exs mix.lock ./
RUN mix do deps.get, deps.compile
COPY ./assets/package.json ./assets/package.json
RUN cd assets && npm install
ADD . .
# Run frontend build, compile, and digest assets
RUN cd assets && \
brunch build --production && \
cd .. && \
mix do compile --warnings-as-errors, phx.digest
# USER default
CMD ["mix", "phx.server"]