forked from t2bot/matrix-media-repo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Complement.Dockerfile
45 lines (34 loc) · 1.2 KB
/
Complement.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
# ---- Stage 0 ----
# Builds media repo binaries
FROM golang:1.16-alpine AS builder
# Install build dependencies
RUN apk add --no-cache git musl-dev dos2unix build-base
WORKDIR /opt
COPY . /opt
RUN dos2unix ./build.sh
RUN ./build.sh
# ---- Stage 1 ----
# Final runtime stage.
FROM alpine
COPY --from=builder /opt/bin/media_repo /opt/bin/complement_hs /usr/local/bin/
RUN apk add --no-cache ca-certificates postgresql openssl dos2unix
RUN mkdir -p /data/media
COPY ./docker/complement.yaml /data/media-repo.yaml
ENV REPO_CONFIG=/data/media-repo.yaml
ENV SERVER_NAME=localhost
ENV PGDATA=/data/pgdata
ENV MEDIA_REPO_UNSAFE_FEDERATION=true
COPY ./docker/complement.sh ./docker/complement-run.sh /usr/local/bin/
RUN dos2unix /usr/local/bin/complement.sh /usr/local/bin/complement-run.sh
EXPOSE 8008
EXPOSE 8448
RUN chmod +x /usr/local/bin/complement.sh
RUN chmod +x /usr/local/bin/complement-run.sh
RUN mkdir -p /data/pgdata
RUN mkdir -p /run/postgresql
RUN chown postgres:postgres /data/pgdata
RUN chown postgres:postgres /run/postgresql
RUN su postgres -c initdb
RUN sh /usr/local/bin/complement.sh
CMD /usr/local/bin/complement-run.sh
HEALTHCHECK CMD curl --fail http://localhost:8008/_matrix/media/version || exit 1