-
-
Notifications
You must be signed in to change notification settings - Fork 126
Expand file tree
/
Copy pathDockerfile
More file actions
103 lines (79 loc) · 2.61 KB
/
Dockerfile
File metadata and controls
103 lines (79 loc) · 2.61 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
ARG BUILDER_IMAGE="hexpm/elixir:1.18.4-erlang-28.0.1-ubuntu-noble-20250619"
ARG RUNNER_IMAGE="ubuntu:24.04"
FROM ${BUILDER_IMAGE} as builder
RUN apt-get update && apt-get install -y \
build-essential \
git \
curl \
bash \
ca-certificates \
nodejs \
npm \
openssl \
libncurses5-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
ENV NODE_VERSION 22.17.0
ENV PRESENTATION_STORAGE_DIR /app/uploads
# custom ERL_FLAGS are passed for (public) multi-platform builds
# to fix qemu segfault, more info: https://github.com/erlang/otp/pull/6340
ARG ERL_FLAGS
ENV ERL_FLAGS=$ERL_FLAGS
# prepare build dir
WORKDIR /app
# install hex + rebar
RUN mix local.hex --force && \
mix local.rebar --force
# set build ENV
ENV MIX_ENV="prod"
# install mix dependencies
COPY mix.exs mix.lock ./
RUN mix deps.get --only $MIX_ENV
RUN mkdir config
# copy compile-time config files before we compile dependencies
# to ensure any relevant config change will trigger the dependencies
# to be re-compiled.
COPY config/config.exs config/${MIX_ENV}.exs config/
RUN mix deps.compile
COPY priv priv
COPY assets assets
COPY lib lib
RUN mix compile
RUN mix assets.deploy
COPY config/runtime.exs config/
COPY rel rel
RUN mix release
# start a new build stage so that the final image will only contain
# the compiled release and other runtime necessities
FROM ${RUNNER_IMAGE}
RUN apt-get update -y && apt-get install -y curl libstdc++6 openssl locales ghostscript default-jre libreoffice-java-common \
&& apt-get install -y libreoffice --no-install-recommends && apt-get clean && rm -f /var/lib/apt/lists/*_*
# RUN apk add --no-cache curl libstdc++ openssl ncurses ghostscript openjdk11-jre
# Install LibreOffice & Common Fonts
RUN apt-get update && apt-get install -y \
libreoffice \
fonts-dejavu \
fonts-freefont-ttf \
fonts-liberation \
fonts-droid-fallback \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install Microsoft Core Fonts
RUN apt-get update && apt-get install -y \
ttf-mscorefonts-installer \
fontconfig \
&& fc-cache -f \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
ENV MIX_ENV="prod"
# Only copy the final release from the build stage
COPY --from=builder --chmod=a+rX /app/_build/prod/rel/claper /app
COPY --from=builder /app/priv/repo/seeds.exs /app/priv/repo/
RUN mkdir /app/uploads && chmod -R 777 /app/uploads
EXPOSE 4000
WORKDIR "/app"
USER root
CMD ["sh", "-c", "/app/bin/claper eval Claper.Release.migrate && /app/bin/claper eval Claper.Release.seeds && /app/bin/claper start"]