dragonfly/tools/packaging/Dockerfile.ubuntu-dev

42 lines
1.1 KiB
Docker
Raw Normal View History

# syntax=docker/dockerfile:1
FROM ghcr.io/romange/ubuntu-dev:20 as builder
WORKDIR /build
COPY . ./
RUN make release
RUN build-release/dragonfly --version
RUN curl -O https://raw.githubusercontent.com/ncopa/su-exec/212b75144bbc06722fbd7661f651390dc47a43d1/su-exec.c && \
gcc -Wall -O2 su-exec.c -o su-exec
FROM ubuntu:20.04
RUN --mount=type=tmpfs,target=/var/cache/apt \
--mount=type=tmpfs,target=/var/lib/apt/lists \
apt update && \
apt install -q -y --no-install-recommends netcat-openbsd ca-certificates redis-tools net-tools
RUN groupadd -r -g 999 dfly && useradd -r -g dfly -u 999 dfly
RUN mkdir /data && chown dfly:dfly /data
VOLUME /data
WORKDIR /data
COPY tools/docker/entrypoint.sh /usr/local/bin/entrypoint.sh
COPY tools/docker/healthcheck.sh /usr/local/bin/healthcheck.sh
COPY --from=builder /build/su-exec /usr/local/bin/
COPY --from=builder /build/build-release/dragonfly /usr/local/bin/
HEALTHCHECK CMD /usr/local/bin/healthcheck.sh
ENTRYPOINT ["entrypoint.sh"]
# For inter-container communication.
EXPOSE 6379
USER dfly
CMD ["dragonfly", "--logtostderr"]