* Add Dockerfile and docker-compose.yml for containerized setup; create .dockerignore

* Update CI pipeline and Docker configuration for improved build process and health checks
This commit is contained in:
2025-11-24 12:42:34 +00:00
committed by GitHub
parent 1c3c31a7b8
commit 8d26913c62
3 changed files with 12 additions and 13 deletions

View File

@@ -37,8 +37,8 @@ jobs:
make clean && make make clean && make
# Verify the binary was created # Verify the binary was created
test -f server && echo "✓ Server binary built successfully" test -f server && echo "✓ Server binary built successfully"
# Basic smoke tests # Basic smoke tests - verify it's a valid ELF executable
./server --help || echo "✓ Server executable is valid" file server | grep -q "ELF.*executable" && echo "✓ Server executable is valid"
echo "✓ All tests passed" echo "✓ All tests passed"
security-scan: security-scan:

View File

@@ -11,16 +11,15 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libnghttp2-dev \ libnghttp2-dev \
pkg-config \ pkg-config \
build-essential \ build-essential \
git \
ca-certificates \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
WORKDIR /build WORKDIR /build
COPY src/ ./src/ RUN git clone --depth 1 --branch main https://github.com/Azreyo/Carbon.git . && \
COPY Makefile . make clean && make release
COPY server.conf .
RUN make clean && make release
FROM debian:bookworm-slim 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 /app/
COPY --from=builder /build/server.conf /app/ COPY --from=builder /build/server.conf /app/
COPY --from=builder /build/www/ /app/www/
COPY www/ ./www/ COPY --from=builder /build/README.md /app/
COPY --from=builder /build/DOCUMENTATION.md /app/
COPY README.md DOCUMENTATION.md LICENSE ./ COPY --from=builder /build/LICENSE /app/
RUN chown -R carbon:carbon /app RUN chown -R carbon:carbon /app
USER carbon USER carbon
EXPOSE 8080 8443 EXPOSE 8080 443
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8080/ || exit 1 CMD curl -f http://localhost:8080/ || exit 1

View File

@@ -8,7 +8,7 @@ services:
container_name: carbon-http-server container_name: carbon-http-server
ports: ports:
- "8080:8080" # HTTP port - "8080:8080" # HTTP port
- "8443:8443" # HTTPS port - "443:443" # HTTPS port
volumes: volumes:
# Mount www directory for easy content updates # Mount www directory for easy content updates
- ./www:/app/www:ro - ./www:/app/www:ro