forked from relaypro-open/dog_agent_ex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.local_deploy
59 lines (52 loc) · 1.79 KB
/
Dockerfile.local_deploy
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
# Build stage 0
FROM elixir:1.14 as base
RUN apt-get update && apt-get install -y libcap-dev iptables ipset less ack lsb-release vim jq curl dnsutils netcat xzip
WORKDIR /tmp
RUN wget -q https://ziglang.org/download/0.10.1/zig-linux-x86_64-0.10.1.tar.xz
RUN tar xf zig-linux-x86_64-0.10.1.tar.xz
ENV PATH="$PATH:/tmp/zig-linux-x86_64-0.10.1"
RUN zig version
RUN mkdir -p /opt/dog_ex
RUN mkdir -p /etc/dog_ex
RUN mkdir -p /etc/iptables
RUN mkdir -p /var/log/dog_ex
RUN mkdir -p /home/dog/bin
RUN cp /usr/sbin/ipset /home/dog/bin/ipset
RUN cp /usr/sbin/iptables-save /home/dog/bin/
RUN cp /usr/sbin/ip6tables-save /home/dog/bin/
RUN cp /usr/sbin/iptables-restore /home/dog/bin/
RUN cp /usr/sbin/ip6tables-restore /home/dog/bin/
RUN ls -latr /opt/dog_ex
RUN mkdir /etc/rabbitmq
COPY csc_certs.sh /etc/rabbitmq/
RUN mkdir -p /etc/dog_ex/certs \
&& mkdir -p /etc/dog_ex/private \
&& chmod 700 /etc/dog_ex/private
RUN ln -s /usr/bin/python3 /usr/bin/python
#Set working directory
RUN mkdir /data
WORKDIR /data
ENV MIX_ENV=dev
COPY mix.exs .
COPY mix.lock .
RUN mix local.hex --force
RUN mix local.rebar --force
RUN mix deps.get
RUN mix deps.compile
WORKDIR /data
COPY lib lib
RUN mix compile
#Build the release
COPY config/config.exs config/
COPY config/runtime.dev.exs config/runtime.exs
COPY config/dot_env.dev.config /etc/dog_ex/dot_env.config
COPY config/config.json.dev /etc/dog_ex/config.json
RUN mix release dog
# Install the released application
RUN mv /data/_build/dev/rel/dog/* /opt/dog_ex/
RUN tar czf /tmp/dog_agent_ex.tar.gz /opt/dog_ex
#FROM scratch AS tar
#COPY --from=base /data/burrito_out/dog_linux /
#COPY --from=base /tmp/dog_agent_ex.tar.gz /
CMD /bin/sh -c "/etc/rabbitmq/csc_certs.sh" && /bin/sh -c "/opt/dog_ex/bin/dog start"
#CMD /bin/bash -c "/etc/rabbitmq/csc_certs.sh" && /bin/bash -c "sleep infinity"