From 8d26913c62b8a02241aca51de5d5919ab0c90dc6 Mon Sep 17 00:00:00 2001 From: Azreyo <58790873+Azreyo@users.noreply.github.com> Date: Mon, 24 Nov 2025 12:42:34 +0000 Subject: [PATCH] Develop (#7) * Add Dockerfile and docker-compose.yml for containerized setup; create .dockerignore * Update CI pipeline and Docker configuration for improved build process and health checks --- .github/workflows/ci.yml | 4 ++-- Dockerfile | 19 +++++++++---------- docker-compose.yml | 2 +- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e8a0856..877a239 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,8 +37,8 @@ jobs: make clean && make # Verify the binary was created test -f server && echo "✓ Server binary built successfully" - # Basic smoke tests - ./server --help || echo "✓ Server executable is valid" + # Basic smoke tests - verify it's a valid ELF executable + file server | grep -q "ELF.*executable" && echo "✓ Server executable is valid" echo "✓ All tests passed" security-scan: diff --git a/Dockerfile b/Dockerfile index a6aa4cf..308032f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,16 +11,15 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ libnghttp2-dev \ pkg-config \ build-essential \ + git \ + ca-certificates \ && rm -rf /var/lib/apt/lists/* WORKDIR /build -COPY src/ ./src/ -COPY Makefile . -COPY server.conf . - -RUN make clean && make release +RUN git clone --depth 1 --branch main https://github.com/Azreyo/Carbon.git . && \ + make clean && make release FROM debian:bookworm-slim @@ -44,16 +43,16 @@ RUN mkdir -p /app/www /app/log /app/ssl/cert && \ COPY --from=builder /build/server /app/ COPY --from=builder /build/server.conf /app/ - -COPY www/ ./www/ - -COPY README.md DOCUMENTATION.md LICENSE ./ +COPY --from=builder /build/www/ /app/www/ +COPY --from=builder /build/README.md /app/ +COPY --from=builder /build/DOCUMENTATION.md /app/ +COPY --from=builder /build/LICENSE /app/ RUN chown -R carbon:carbon /app USER carbon -EXPOSE 8080 8443 +EXPOSE 8080 443 HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ CMD curl -f http://localhost:8080/ || exit 1 diff --git a/docker-compose.yml b/docker-compose.yml index 314fa4f..2cbb2c2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,7 +8,7 @@ services: container_name: carbon-http-server ports: - "8080:8080" # HTTP port - - "8443:8443" # HTTPS port + - "443:443" # HTTPS port volumes: # Mount www directory for easy content updates - ./www:/app/www:ro