-
Notifications
You must be signed in to change notification settings - Fork 73
/
Dockerfile
51 lines (42 loc) · 1.82 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
FROM alpine:3.4
# Setup Operable APK repository
COPY config/docker/operable-56f35cdd.rsa.pub /etc/apk/keys/operable-56f35cdd.rsa.pub
RUN echo "@operable https://storage.googleapis.com/operable-apk/" > /etc/apk/repositories.operable && \
cat /etc/apk/repositories >> /etc/apk/repositories.operable && \
mv /etc/apk/repositories.operable /etc/apk/repositories
# Select mix environment to use. We declare the MIX_ENV at build time
ARG MIX_ENV
ENV MIX_ENV ${MIX_ENV:-dev}
# Install dependencies that will be used at runtime. Build
# time dependencies are installed _and_ removed during the
# build stage layer.
RUN apk update -U && \
apk add erlang erlang-crypto erlang-dev erlang-ssh erlang-ssl erlang-mnesia erlang-syntax-tools erlang-parsetools \
erlang-xmerl bash git postgresql-client elixir
# Setup Operable user. UID/GID default to 60000 but can be overriden.
ARG OPERABLE_UID
ENV OPERABLE_UID ${OPERABLE_UID:-60000}
ARG OPERABLE_GID
ENV OPERABLE_GID ${OPERABLE_UID:-60000}
RUN addgroup -g $OPERABLE_GID operable && \
adduser -h /home/operable -D -u $OPERABLE_UID -G operable -s /bin/ash operable
# Create directories and upload cog source
RUN mkdir -p /home/operable/cog /home/operable/cogctl
COPY . /home/operable/cog/
RUN chown -R operable /home/operable && \
rm -f /home/operable/.dockerignore
# We do this all in one huge RUN command to get the smallest
# possible image.
USER root
RUN apk update -U && \
apk add expat-dev gcc g++ make && \
# build cog and cogctl \
su operable - -c /home/operable/cog/scripts/docker-build && \
# install cogctl and delete source directory \
cp /home/operable/cogctl/cogctl /usr/local/bin/cogctl && \
rm -rf /home/operable/cogctl && \
# cleanup dependencies
apk del gcc g++ && \
rm -f /var/cache/apk/*
USER operable
WORKDIR /home/operable/cog