-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
45 lines (31 loc) Β· 954 Bytes
/
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
# Build
FROM bitwalker/alpine-elixir:1.9.1 as build
# Mix build environment
ARG MIX_ENV=prod
# Whether or not to clean build files from local machine
ARG CLEAN
# Set env vars
ENV MIX_ENV=${MIX_ENV} \
CLEAN=${CLEAN}
# Copy source to image
COPY . .
# Clean, unless arg is passed
RUN if [ "X$CLEAN" = "x" ] ; then rm -rf _build; echo deleted ; else echo not deleted ; fi
# Use distillery to build a release
RUN mix deps.get && \
mix distillery.release
# Extract distillery tarball
RUN APP_NAME="discordbot_umbrella" && \
RELEASE_DIR=`ls -d _build/$MIX_ENV/rel/$APP_NAME/releases/*/` && \
mkdir /export && \
tar -xf "$RELEASE_DIR/$APP_NAME.tar.gz" -C /export
#Deploy
FROM bitwalker/alpine-elixir:1.9.1
# Copy release from previous stage
COPY --from=build /export/ .
# Install ffmpeg
RUN apk add --no-cache ffmpeg
USER default
# Launch generated application
ENTRYPOINT ["/opt/app/bin/discordbot_umbrella"]
CMD ["foreground"]