2022-02-25 18:19:01 +00:00
|
|
|
# syntax=docker/dockerfile:1
|
2022-04-25 09:06:31 +00:00
|
|
|
from ghcr.io/romange/ubuntu-dev:20 as builder
|
2022-02-25 18:19:01 +00:00
|
|
|
|
2022-05-30 08:24:56 +00:00
|
|
|
ARG TARGETPLATFORM
|
2022-05-11 17:37:25 +00:00
|
|
|
|
2022-02-25 18:19:01 +00:00
|
|
|
WORKDIR /build
|
2022-05-30 08:24:56 +00:00
|
|
|
COPY tools/docker/fetch_release.sh /tmp/
|
|
|
|
COPY releases/dragonfly-* /tmp/
|
|
|
|
|
2022-02-25 18:19:01 +00:00
|
|
|
RUN curl -O https://raw.githubusercontent.com/ncopa/su-exec/master/su-exec.c && \
|
|
|
|
gcc -Wall -O2 su-exec.c -o su-exec
|
|
|
|
|
2022-05-30 08:24:56 +00:00
|
|
|
RUN /tmp/fetch_release.sh ${TARGETPLATFORM}
|
|
|
|
|
|
|
|
|
2022-05-11 09:48:53 +00:00
|
|
|
# Now prod image
|
2022-02-25 18:19:01 +00:00
|
|
|
FROM ubuntu:20.04
|
2022-05-11 17:37:25 +00:00
|
|
|
|
2022-05-12 06:13:49 +00:00
|
|
|
# ARG in fact change the env vars during the build process
|
|
|
|
# ENV persist the env vars for the built image as well.
|
2022-05-11 17:37:25 +00:00
|
|
|
ARG QEMU_CPU
|
2022-05-12 06:13:49 +00:00
|
|
|
ARG DEBIAN_FRONTEND=noninteractive
|
2022-05-11 17:37:25 +00:00
|
|
|
|
2022-12-07 14:44:07 +00:00
|
|
|
RUN apt clean && apt update && apt -y install netcat-openbsd
|
|
|
|
|
2022-02-25 18:19:01 +00:00
|
|
|
|
|
|
|
RUN groupadd -r -g 999 dfly && useradd -r -g dfly -u 999 dfly
|
|
|
|
RUN mkdir /data && chown dfly:dfly /data
|
2022-05-30 08:24:56 +00:00
|
|
|
|
2022-02-25 18:19:01 +00:00
|
|
|
VOLUME /data
|
|
|
|
WORKDIR /data
|
|
|
|
COPY tools/docker/entrypoint.sh /usr/local/bin/entrypoint.sh
|
2022-12-07 14:44:07 +00:00
|
|
|
COPY tools/docker/healthcheck.sh /usr/local/bin/healthcheck.sh
|
2022-05-30 08:24:56 +00:00
|
|
|
COPY --from=builder /build/su-exec /usr/local/bin/
|
|
|
|
COPY --from=builder /build/dragonfly /usr/local/bin/
|
2022-02-25 18:19:01 +00:00
|
|
|
|
2022-12-07 14:44:07 +00:00
|
|
|
HEALTHCHECK CMD /usr/local/bin/healthcheck.sh
|
2022-02-25 18:19:01 +00:00
|
|
|
ENTRYPOINT ["entrypoint.sh"]
|
|
|
|
|
2022-05-12 06:13:49 +00:00
|
|
|
# For inter-container communication.
|
|
|
|
EXPOSE 6379
|
|
|
|
|
2022-05-30 08:24:56 +00:00
|
|
|
CMD ["dragonfly", "--logtostderr"]
|