forked from Accenture/reactive-interaction-gateway
-
Notifications
You must be signed in to change notification settings - Fork 0
/
aws.dockerfile
64 lines (46 loc) · 1.59 KB
/
aws.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
60
61
62
63
64
FROM maven:3-jdk-8-alpine as java-build
COPY kinesis-client /opt/sites/rig/kinesis-client
WORKDIR /opt/sites/rig/kinesis-client
# Compile AWS Kinesis Java application
RUN mvn package
FROM elixir:1.11.3-alpine as elixir-build
# Install Elixir & Erlang environment dependencies
RUN apk add --no-cache make gcc g++
COPY .tool-versions /opt/sites/rig/
RUN mix local.hex --force
RUN mix local.rebar --force
ENV MIX_ENV=prod
WORKDIR /opt/sites/rig
# Copy release config
COPY rel /opt/sites/rig/rel/
COPY vm.args /opt/sites/rig/
# Copy necessary files for dependencies
COPY mix.exs /opt/sites/rig/
COPY mix.lock /opt/sites/rig/
# Install project dependencies and compile them
RUN mix deps.get && mix deps.compile && mix deps.clean mime --build
# Copy application files
COPY config /opt/sites/rig/config
COPY lib /opt/sites/rig/lib
# Compile and release application production code
RUN mix compile
RUN mix distillery.release
FROM erlang:23-alpine
RUN apk add --no-cache bash
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
ENV REPLACE_OS_VARS=true
ENV KINESIS_OTP_JAR=/opt/sites/rig/kinesis-client/local-maven-repo/org/erlang/otp/jinterface/1.8.1/jinterface-1.8.1.jar
# Install Java
RUN apk add --no-cache openjdk8-jre
RUN addgroup -S rig -g 1000 && adduser -S rig -G rig --uid 1000
WORKDIR /opt/sites/rig
COPY --from=elixir-build /opt/sites/rig/_build/prod/rel/rig /opt/sites/rig/
COPY --from=java-build opt/sites/rig/kinesis-client /opt/sites/rig/kinesis-client
RUN chown -R rig:rig /opt/sites/rig
USER rig
# Proxy
EXPOSE 4000
# Internal APIs
EXPOSE 4010
CMD trap exit INT; trap exit TERM; /opt/sites/rig/bin/rig foreground & wait