This repository has been archived by the owner on Jan 21, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
61 lines (47 loc) · 1.79 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
# syntax=docker/dockerfile:1
ARG VCS_REF
ARG BUILD_DATE
FROM hexpm/elixir:1.17.2-erlang-27.0.1-alpine-3.20.2 AS base
FROM base AS builder
ENV MIX_ENV=prod
ENV ERL_EPMD_ADDRESS=127.0.0.1
ARG VCS_REF
WORKDIR /opt/akkoma
# build dependencies
RUN apk add --no-cache git gcc g++ musl-dev make cmake file-dev exiftool \
ffmpeg imagemagick libmagic ncurses postgresql-client
# Create a build user
RUN addgroup -g 1000 akkoma && \
adduser -u 1000 -G akkoma -D -h $(pwd) akkoma
USER akkoma
# Clone the akkoma repository at the specified ref
RUN echo "Using $VCS_REF" &&\
git clone https://akkoma.dev/AkkomaGang/akkoma.git . &&\
git checkout "$VCS_REF"
# Download all dependencies and compile the application
RUN mix local.hex --force &&\
mix local.rebar --force &&\
mix do deps.get, deps.compile, compile, phx.digest, release
FROM alpine:3.21 AS runtime
ARG VCS_REF
ARG BUILD_DATE
LABEL org.opencontainers.image.title="akkoma" \
org.opencontainers.image.description="Magically expressive social media" \
org.opencontainers.image.vendor="jaredallard" \
org.opencontainers.image.documentation="https://docs.akkoma.dev/stable/" \
org.opencontainers.image.licenses="AGPL-3.0 AND GPL-3.0" \
org.opencontainers.image.url="https://akkoma.dev" \
org.opencontainers.image.revision=$VCS_REF \
org.opencontainers.image.created=$BUILD_DATE
EXPOSE 4000
CMD trap 'exit' INT; pleroma start
WORKDIR /opt/akkoma
ENV PATH /opt/akkoma/bin:$PATH
# Create a user for running the app
RUN addgroup -g 1000 akkoma && \
adduser -u 1000 -G akkoma -D -h $(pwd) akkoma
# Install runtime dependencies
RUN apk add --no-cache file-dev exiftool ffmpeg imagemagick libmagic ncurses postgresql-client
# Copy the files from the builder image over.
COPY --chown=1000:1000 --from=builder /opt/akkoma/_build/prod/rel/pleroma .
USER akkoma