File size: 1,568 Bytes
a81b50d
b2ff4b5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
be8afd0
b2ff4b5
226c073
f1b3f38
 
 
074c4ba
d87aab1
 
 
 
992d01e
d87aab1
b2ff4b5
 
a81b50d
b2ff4b5
d51ffcb
 
be8afd0
 
 
 
 
 
fad8cab
 
be8afd0
 
b55b485
718696f
be8afd0
 
d7f46a5
be8afd0
26ae336
718696f
 
 
245675b
d7f46a5
ca73970
 
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
FROM elixir:1.13.4-slim AS builderish

WORKDIR /app

COPY mix.exs .
COPY mix.lock .
COPY .formatter.exs .

RUN mix local.hex --force
RUN mix local.rebar --force
RUN mix deps.get

COPY lib/ ./lib/
COPY config/ ./config/

ENV MIX_ENV=prod
RUN mix release

FROM elixir:1.13.4-slim

RUN apt-get update && apt-get install -y supervisor adduser sudo curl gpg lsb-release && apt-get clean all

RUN useradd -m rabil && echo "rabil:rabil" | chpasswd && adduser rabil sudo
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers

RUN curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
RUN sudo chmod 644 /usr/share/keyrings/redis-archive-keyring.gpg
RUN echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list
RUN sudo apt-get update
RUN sudo apt-get install -y redis-stack-server

WORKDIR /app

COPY --from=builderish /app/_build/prod/rel/prod/ ./_build/prod/rel/prod/

USER rabil

ARG SRH_MODE
ENV SRH_MODE=${SRH_MODE}

ARG SRH_TOKEN
ENV SRH_TOKEN=${SRH_TOKEN}

ARG SRH_CONNECTION_STRING
ENV SRH_CONNECTION_STRING=${SRH_CONNECTION_STRING}

ENV SRH_PORT=7860
EXPOSE 7860
ENV MIX_ENV=prod

COPY docker/supervisor.conf /etc/supervisor/conf.d/supervisor.conf
COPY docker/redis.conf /etc/redis/redis.conf

RUN sudo mkdir -p /etc/lib/redis

RUN sudo chmod -R 777 /etc/redis/
RUN sudo chmod -R 777 /app
RUN sudo chmod -R 777 /etc/lib/redis


CMD ["supervisord", "-c", "/etc/supervisor/conf.d/supervisor.conf"]