-
Notifications
You must be signed in to change notification settings - Fork 71
/
Dockerfile
48 lines (38 loc) · 1.55 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
FROM operable/elixir:1.3.4-r0
ENV MIX_ENV prod
RUN addgroup -g 60000 operable && \
adduser -h /home/operable -D -u 60000 -G operable -s /bin/ash operable
# Create directories and upload cog source
WORKDIR /home/operable/cog
# Really, we only need the cog directory to be owned by operable,
# because (by default) that's where we write log files. None of the
# actual scripts or library files need to be owned by operable.
RUN chown -R operable /home/operable/cog
COPY mix.exs mix.lock /home/operable/cog/
COPY config/ /home/operable/cog/config/
RUN mix deps.get --only=prod --no-archives-check
# Compile all the dependencies. The additional packages installed here
# are for Greenbar to build and run.
RUN apk --no-cache add \
--virtual .build_deps \
gcc \
g++ && \
apk --no-cache add \
expat-dev \
libstdc++ && \
mix deps.compile && \
apk del .build_deps
COPY emqttd_plugins/ /home/operable/cog/emqttd_plugins/
COPY priv/ /home/operable/cog/priv/
COPY web/ /home/operable/cog/web/
COPY lib/ /home/operable/cog/lib/
RUN mix compile --no-deps-check --no-archives-check
COPY scripts/ /home/operable/cog/scripts/
# This should be in place in the build environment already
COPY cogctl-for-docker-build /usr/local/bin/cogctl
USER operable
# TODO: For some reason, Hex needs to be present in the operable
# user's home directory for Cog to run (specifically, for it to apply
# the database migrations at startup). It complains of not being able
# to build gen_stage, *even though it's already been built!*
RUN mix local.hex --force