Refactor logging system and enhance Dockerfile configuration
- Introduced a new logging system with configurable log levels and categories. - Added support for different log formats: plain text, JSON, and syslog. - Updated Dockerfile to use Alpine 3.19 and improved build process. - Enhanced server configuration to replace verbose logging with log modes (off, classic, debug, advanced). - Improved security measures in SSL context configuration. - Added health checks and resource limits in docker-compose.yml. - Refactored Makefile to include new logging source files. - Updated server configuration to set default log file path and SSL certificate paths. - Enhanced performance tracking and logging capabilities. - Added hex dump utility for debugging binary data.
This commit is contained in:
38
Dockerfile
38
Dockerfile
@@ -1,5 +1,6 @@
|
||||
FROM alpine:edge AS builder
|
||||
FROM alpine:3.19 AS builder
|
||||
|
||||
# Install build dependencies
|
||||
RUN apk add --no-cache \
|
||||
gcc \
|
||||
g++ \
|
||||
@@ -12,15 +13,20 @@ RUN apk add --no-cache \
|
||||
zlib-dev \
|
||||
git \
|
||||
ca-certificates \
|
||||
&& apk update \
|
||||
&& apk upgrade --available
|
||||
&& rm -rf /var/cache/apk/*
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
RUN git clone --depth 1 --branch main https://github.com/Azreyo/Carbon.git . && \
|
||||
make clean && make release
|
||||
COPY . .
|
||||
|
||||
FROM alpine:edge
|
||||
RUN make clean && make release
|
||||
|
||||
|
||||
FROM alpine:3.19
|
||||
|
||||
LABEL maintainer="Carbon Team" \
|
||||
version="1.0" \
|
||||
description="Carbon Web Server - High Performance HTTP Server"
|
||||
|
||||
RUN apk add --no-cache \
|
||||
libssl3 \
|
||||
@@ -29,17 +35,17 @@ RUN apk add --no-cache \
|
||||
zlib \
|
||||
ca-certificates \
|
||||
curl \
|
||||
&& apk update \
|
||||
&& apk upgrade --available \
|
||||
&& rm -rf /tmp/* /var/cache/apk/*
|
||||
&& rm -rf /var/cache/apk/* /tmp/*
|
||||
|
||||
RUN adduser -D -u 1000 -s /bin/sh carbon
|
||||
RUN addgroup -g 1000 carbon && \
|
||||
adduser -D -u 1000 -G carbon -s /sbin/nologin carbon
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN mkdir -p /app/www /app/log /app/ssl/cert /app/ssl/key && \
|
||||
chown -R carbon:carbon /app && \
|
||||
chmod 755 /app && \
|
||||
chmod 750 /app/ssl
|
||||
chmod 755 /app /app/www /app/log && \
|
||||
chmod 700 /app/ssl /app/ssl/cert /app/ssl/key
|
||||
|
||||
COPY --from=builder --chown=carbon:carbon /build/server /app/
|
||||
COPY --from=builder --chown=carbon:carbon /build/www/ /app/www/
|
||||
@@ -48,7 +54,8 @@ COPY --from=builder --chown=carbon:carbon /build/DOCUMENTATION.md /app/
|
||||
COPY --from=builder --chown=carbon:carbon /build/LICENSE /app/
|
||||
COPY --chown=carbon:carbon entrypoint.sh /app/entrypoint.sh
|
||||
|
||||
RUN chmod 500 /app/server /app/entrypoint.sh
|
||||
RUN chmod 500 /app/server /app/entrypoint.sh && \
|
||||
chmod 644 /app/README.md /app/DOCUMENTATION.md /app/LICENSE 2>/dev/null || true
|
||||
|
||||
USER carbon
|
||||
|
||||
@@ -58,10 +65,13 @@ ENV SERVER_NAME=0.0.0.0 \
|
||||
ENABLE_HTTP2=false \
|
||||
ENABLE_WEBSOCKET=false \
|
||||
MAX_THREADS=4 \
|
||||
VERBOSE=true
|
||||
MAX_CONNECTIONS=1024 \
|
||||
LOG_MODE=classic
|
||||
|
||||
EXPOSE 8080 8443
|
||||
|
||||
|
||||
|
||||
ENTRYPOINT ["/app/entrypoint.sh"]
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
||||
|
||||
Reference in New Issue
Block a user