/
Dockerfile
51 lines (39 loc) · 1.41 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
FROM docker.io/debian:bullseye-slim as build
LABEL org.opencontainers.image.title="LinuxFr.org image caching service"
LABEL org.opencontainers.image.description="Store external images into a cache to not flood external website"
LABEL org.opencontainers.image.source="https://github.com/linuxfrorg/img-LinuxFr.org"
LABEL org.opencontainers.image.url="https://github.com/linuxfrorg/linuxfr.org/blob/master/Container.md"
LABEL org.opencontainers.image.licenses="AGPL-3.0-only"
LABEL org.opencontainers.image.version="2.1"
LABEL org.opencontainers.image.authors="Adrien Dorsaz <adrien@adorsaz.ch>"
ARG UID=1200
RUN \
set -eux; \
IFS=$'\n\t'; \
apt-get update; \
apt-get install -y --no-install-recommends \
golang git ca-certificates; \
apt-get clean;
USER ${UID}
ENV GOPATH=/linuxfr-img
ENV HOME=/linuxfr-img
WORKDIR /linuxfr-img
# Build linuxfr-img
RUN go get -u github.com/linuxfrorg/img-LinuxFr.org
FROM docker.io/debian:bullseye-slim as deploy
ARG UID=1200
# Install curl to be used by the healthcheck defined in compose.yaml
RUN \
set -eux; \
IFS=$'\n\t'; \
apt-get update; \
apt-get install -y --no-install-recommends \
curl; \
apt-get clean;
USER ${UID}
ENV GOPATH=/linuxfr-img
ENV HOME=/linuxfr-img
WORKDIR /linuxfr-img
COPY --from=build --chown=${UID}:0 --chmod=770 /linuxfr-img/bin/img-LinuxFr.org .
EXPOSE 8000
CMD ["sh", "-c", "exec ./img-LinuxFr.org -a 0.0.0.0:8000 -r \"${REDIS_URL##redis://}\""]