-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
61 lines (45 loc) · 1.37 KB
/
Dockerfile
File metadata and controls
61 lines (45 loc) · 1.37 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
# ===================================================================================
FROM hexpm/elixir:1.18.4-erlang-27.3.4-alpine-3.21.3 AS build
# install build dependencies
# RUN apk add --no-cache build-base npm git python
RUN apk update && apk add --no-cache build-base npm git libgcc libstdc++ make
# 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 ./
COPY config config
RUN mix do deps.get, deps.compile
COPY priv priv
COPY assets assets
COPY lib lib
# uncomment COPY if rel/ exists
# COPY rel rel
# build assets, digest files, compile, build release and clean up
RUN mix assets.deploy \
&& mix compile \
&& mix release \
&& mix phx.digest.clean --all
# ===================================================================================
# prepare release image
FROM alpine:3.21 AS app
# Add User
RUN adduser -D posa
RUN apk update \
&& apk upgrade --no-cache \
&& apk add --no-cache postgresql-client bash openssl libgcc libstdc++ ncurses-libs make
WORKDIR /app
# Copy release to running image
COPY --from=build /app/_build/prod/rel/posa ./
RUN chgrp -R 0 /app \
&& chmod -R g=u /app
# USER nobody:nobody
USER posa
ENV HOME=/app
# Starts Posa
# CMD ["bin/posa", "start"]
ENTRYPOINT ["bin/posa", "start"]