Update Dockerfile and .gitignore to include entrypoint script and docker-push.sh

This commit is contained in:
2025-11-26 17:15:17 +01:00
parent 2173258a21
commit b3370b3646
3 changed files with 26 additions and 44 deletions

View File

@@ -34,3 +34,5 @@ Thumbs.db
# Test files # Test files
test/ test/
tests/ tests/
docker-push.sh

1
.gitignore vendored
View File

@@ -58,3 +58,4 @@ ssl/*
!.github/workflows/ !.github/workflows/
src/bin src/bin
docker-push.sh docker-push.sh
entrypoint.sh

View File

@@ -1,43 +1,35 @@
FROM debian:bookworm-slim AS builder FROM alpine:3.19 AS builder
ENV DEBIAN_FRONTEND=noninteractive RUN apk add --no-cache \
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \ gcc \
g++ \
make \ make \
libssl-dev \ musl-dev \
libmagic-dev \ linux-headers \
libnghttp2-dev \ openssl-dev \
pkg-config \ file-dev \
zlib1g-dev \ nghttp2-dev \
build-essential \ zlib-dev \
git \ git \
ca-certificates \ ca-certificates
&& apt-get upgrade -y \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /build WORKDIR /build
RUN git clone --depth 1 --branch main https://github.com/Azreyo/Carbon.git . && \ RUN git clone --depth 1 --branch main https://github.com/Azreyo/Carbon.git . && \
make clean && make release make clean && make release
FROM debian:bookworm-slim FROM alpine:3.19
ENV DEBIAN_FRONTEND=noninteractive RUN apk add --no-cache \
RUN apt-get update && apt-get install -y --no-install-recommends \
libssl3 \ libssl3 \
libmagic1 \ libmagic \
libnghttp2-14 \ nghttp2-libs \
zlib1g \ zlib \
ca-certificates \ ca-certificates \
curl \ wget \
&& apt-get upgrade -y \ && rm -rf /tmp/* /var/cache/apk/*
&& rm -rf /var/lib/apt/lists/*
RUN adduser -D -u 1000 -s /bin/sh carbon
RUN useradd -m -u 1000 -s /bin/bash carbon
WORKDIR /app WORKDIR /app
RUN mkdir -p /app/www /app/log /app/ssl/cert /app/ssl/key && \ RUN mkdir -p /app/www /app/log /app/ssl/cert /app/ssl/key && \
@@ -50,8 +42,9 @@ COPY --from=builder --chown=carbon:carbon /build/www/ /app/www/
COPY --from=builder --chown=carbon:carbon /build/README.md /app/ COPY --from=builder --chown=carbon:carbon /build/README.md /app/
COPY --from=builder --chown=carbon:carbon /build/DOCUMENTATION.md /app/ COPY --from=builder --chown=carbon:carbon /build/DOCUMENTATION.md /app/
COPY --from=builder --chown=carbon:carbon /build/LICENSE /app/ COPY --from=builder --chown=carbon:carbon /build/LICENSE /app/
COPY --chown=carbon:carbon entrypoint.sh /app/entrypoint.sh
RUN chmod 500 /app/server RUN chmod 500 /app/server /app/entrypoint.sh
USER carbon USER carbon
@@ -63,23 +56,9 @@ ENV SERVER_NAME=0.0.0.0 \
MAX_THREADS=4 \ MAX_THREADS=4 \
VERBOSE=true VERBOSE=true
CMD echo "# Carbon Server Configuration (Generated from ENV)" > /app/server.conf && \
echo "running = true" >> /app/server.conf && \
echo "port = ${PORT}" >> /app/server.conf && \
echo "use_https = ${USE_HTTPS}" >> /app/server.conf && \
echo "enable_http2 = ${ENABLE_HTTP2}" >> /app/server.conf && \
echo "enable_websocket = ${ENABLE_WEBSOCKET}" >> /app/server.conf && \
echo "server_name = ${SERVER_NAME}" >> /app/server.conf && \
echo "max_threads = ${MAX_THREADS}" >> /app/server.conf && \
echo "max_connections = 1024" >> /app/server.conf && \
echo "log_file = log/server.log" >> /app/server.conf && \
echo "verbose = ${VERBOSE}" >> /app/server.conf && \
echo "www_path = www" >> /app/server.conf && \
echo "ssl_cert_path = ssl/cert/cert.pem" >> /app/server.conf && \
echo "ssl_key_path = ssl/key/key.key" >> /app/server.conf && \
./server
EXPOSE 8080 8443 EXPOSE 8080 8443
ENTRYPOINT ["/app/entrypoint.sh"]
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:${PORT:-8080}/ || exit 1 CMD wget --no-verbose --tries=1 --spider http://localhost:${PORT:-8080}/ || exit 1