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/
tests/
docker-push.sh

1
.gitignore vendored
View File

@@ -58,3 +58,4 @@ ssl/*
!.github/workflows/
src/bin
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 apt-get update && apt-get install -y --no-install-recommends \
RUN apk add --no-cache \
gcc \
g++ \
make \
libssl-dev \
libmagic-dev \
libnghttp2-dev \
pkg-config \
zlib1g-dev \
build-essential \
musl-dev \
linux-headers \
openssl-dev \
file-dev \
nghttp2-dev \
zlib-dev \
git \
ca-certificates \
&& apt-get upgrade -y \
&& rm -rf /var/lib/apt/lists/*
ca-certificates
WORKDIR /build
RUN git clone --depth 1 --branch main https://github.com/Azreyo/Carbon.git . && \
make clean && make release
FROM debian:bookworm-slim
FROM alpine:3.19
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
RUN apk add --no-cache \
libssl3 \
libmagic1 \
libnghttp2-14 \
zlib1g \
libmagic \
nghttp2-libs \
zlib \
ca-certificates \
curl \
&& apt-get upgrade -y \
&& rm -rf /var/lib/apt/lists/*
wget \
&& rm -rf /tmp/* /var/cache/apk/*
RUN useradd -m -u 1000 -s /bin/bash carbon
RUN adduser -D -u 1000 -s /bin/sh carbon
WORKDIR /app
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/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
RUN chmod 500 /app/server /app/entrypoint.sh
USER carbon
@@ -63,23 +56,9 @@ ENV SERVER_NAME=0.0.0.0 \
MAX_THREADS=4 \
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
ENTRYPOINT ["/app/entrypoint.sh"]
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