1
0
Fork 0
mirror of https://github.com/dragonflydb/dragonfly.git synced 2024-12-14 11:58:02 +00:00
dragonflydb-dragonfly/tools/docker/Dockerfile.ubuntu-prod
2022-05-25 21:14:04 +03:00

49 lines
No EOL
1.4 KiB
Text

# syntax=docker/dockerfile:1
from ghcr.io/romange/ubuntu-dev:20 as builder
# Serves as environment variable during the build
# QEMU_CPU tunes how qemu emulator runs.
ARG QEMU_CPU
WORKDIR /build
COPY src/ ./src/
COPY helio/ ./helio/
COPY patches/ ./patches/
COPY CMakeLists.txt ./
RUN ./helio/blaze.sh -release -DBoost_USE_STATIC_LIBS=ON -DOPENSSL_USE_STATIC_LIBS=ON
WORKDIR build-opt
RUN ninja dragonfly
RUN curl -O https://raw.githubusercontent.com/ncopa/su-exec/master/su-exec.c && \
gcc -Wall -O2 su-exec.c -o su-exec
# Now prod image
FROM ubuntu:20.04
# ARG in fact change the env vars during the build process
# ENV persist the env vars for the built image as well.
ARG QEMU_CPU
ARG ORG_NAME=dragonflydb
ARG DEBIAN_FRONTEND=noninteractive
LABEL org.opencontainers.image.title Dragonfly
LABEL org.opencontainers.image.source https://github.com/${ORG_NAME}/dragonfly
RUN groupadd -r -g 999 dfly && useradd -r -g dfly -u 999 dfly
RUN apt update && apt install -y libunwind8 libssl1.1 && \
rm -rf /var/lib/apt/lists/*
RUN mkdir /data && chown dfly:dfly /data
VOLUME /data
WORKDIR /data
COPY tools/docker/entrypoint.sh /usr/local/bin/entrypoint.sh
COPY --from=builder /build/build-opt/dragonfly /usr/local/bin/
COPY --from=builder /build/build-opt/su-exec /usr/local/bin/
ENTRYPOINT ["entrypoint.sh"]
# For inter-container communication.
EXPOSE 6379
CMD ["dragonfly", "--logtostderr"]