-
Notifications
You must be signed in to change notification settings - Fork 5
/
prod.dockerfile
44 lines (32 loc) · 1.48 KB
/
prod.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
# Source: https://pspdfkit.com/blog/2018/how-to-run-your-phoenix-application-with-docker/
# ./Dockerfile
# Extend from the official Elixir image
FROM elixir:1.6.4
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
RUN apt-get update && \
apt-get install -y postgresql-client inotify-tools nodejs build-essential yarn
# https://hub.docker.com/r/jotadrilo/watchman/~/dockerfile/
ENV WATCHMAN_VERSION=4.9.0
RUN apt-get install -y libssl-dev pkg-config libtool curl ca-certificates build-essential autoconf python-dev libpython-dev autotools-dev automake && \
curl -LO https://github.com/facebook/watchman/archive/v${WATCHMAN_VERSION}.tar.gz && \
tar xzf v${WATCHMAN_VERSION}.tar.gz && rm v${WATCHMAN_VERSION}.tar.gz && \
cd watchman-${WATCHMAN_VERSION} && ./autogen.sh && ./configure && make && make install && \
apt-get purge -y build-essential pkg-config curl autoconf python-dev libpython-dev autotools-dev automake libtool && \
cd /tmp && rm -rf watchman-${WATCHMAN_VERSION}
# Install hex package manager
RUN mix local.hex --force
RUN mix local.rebar --force
# Create app directory and copy the Elixir projects into it
RUN mkdir /app
COPY . /app
WORKDIR /app
RUN yarn
RUN yarn build
RUN mix deps.get
RUN mix phx.digest
# Compile the project
RUN mix do compile
RUN chmod +x /app/entrypoint.sh
CMD ["/app/entrypoint.sh"]