# syntax=docker/dockerfile:1 FROM debian:latest # Install Caddy ENV DEBIAN_FRONTEND=noninteractive RUN apt update && apt install -y curl && \ apt install -y debian-keyring debian-archive-keyring apt-transport-https && \ curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg && \ curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' > /etc/apt/sources.list.d/caddy-stable.list && \ apt update && apt install -y caddy && \ rm -rf /var/lib/apt/lists/* # Create non-root user ARG CUSTOM_UID ARG CUSTOM_GID ENV CUSTOM_USERNAME=webserver ENV CUSTOM_GROUPNAME=webserver RUN groupadd --gid ${CUSTOM_GID:-1000} ${CUSTOM_GROUPNAME} && \ useradd --uid ${CUSTOM_UID:-1000} --gid ${CUSTOM_GID:-1000} --create-home --shell /bin/bash ${CUSTOM_USERNAME} && \ mkdir /app && chown ${CUSTOM_UID:-1000}:${CUSTOM_GID:-1000} /app # Copy source files WORKDIR /app COPY --chown=${CUSTOM_USERNAME}:${CUSTOM_GROUPNAME} development.Caddyfile /app/ COPY --chown=${CUSTOM_USERNAME}:${CUSTOM_GROUPNAME} public /app/public/ COPY --chown=${CUSTOM_USERNAME}:${CUSTOM_GROUPNAME} robots /app/robots/ # Install dependencies USER ${CUSTOM_UID:-1000}:${CUSTOM_GID:-1000} # Run Caddy in development mode ENTRYPOINT ["caddy", "run", "--config", "/app/development.Caddyfile", "--adapter", "caddyfile", "--watch"]