forked from recursiveGecko/race_bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
64 lines (47 loc) · 1.52 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
52
53
54
55
56
57
58
59
60
61
62
63
64
FROM elixir:1.14-slim AS build
ENV MIX_ENV=prod
RUN apt-get update && \
apt-get install -y build-essential git npm && \
apt-get clean && rm -f /var/lib/apt/lists/*_*
WORKDIR /app
# Fetch dependencies
RUN mix local.hex --force && mix local.rebar --force
COPY mix.exs mix.lock ./
RUN mix deps.get --only "${MIX_ENV}"
# Copy static configs and compile dependencies
RUN mkdir config
COPY config/config.exs config/${MIX_ENV}.exs config/
RUN mix deps.compile
# Build assets and code
COPY priv priv
COPY lib lib
COPY assets assets
COPY tsconfig.json package*json ./
RUN mix assets.setup && \
mix assets.deploy && \
mix compile
# Create release
COPY config/runtime.exs config/
RUN mix release
# =================================================
FROM debian:12-slim
RUN apt-get update -y && \
apt-get install -y libstdc++6 openssl libncurses5 locales && \
apt-get clean && \
rm -f /var/lib/apt/lists/*_*
ENV MIX_ENV=prod
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
RUN useradd --create-home --uid 1000 app
WORKDIR /app
RUN chown app /app
COPY --from=build --chown=app:root /app/_build/${MIX_ENV}/rel/f1bot /app/
COPY entrypoint.sh scripts LICENSE.md /app/
# Entrypoint drops privileges to the `app` user
USER root
# Explicitly invoke `bash` to ensure that the entrypoint script can
# run even without the `execute` bit set.
# This happens when the repo is cloned on a Windows filesystem.
CMD ["/bin/bash", "/app/entrypoint.sh"]