Attempt at Docker update

This commit is contained in:
Jonathan Hite 2025-02-06 23:31:39 -05:00
parent 65c325a068
commit 416dec0822

View file

@ -1,37 +1,45 @@
# From original Dockerfile at https://github.com/TheCommsChannel/TC2-BBS-mesh # First stage: Base build environment
FROM debian:stable-slim AS build FROM debian:stable-slim AS build
# Install required dependencies
RUN apt-get update && \ RUN apt-get update && \
apt-get install -y \ apt-get install -y git && \
git \ apt-get clean && rm -rf /var/lib/apt/lists/*
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Clone the repository # Ensure the 'games' directory exists
# RUN git clone https://github.com/TheCommsChannel/TC2-BBS-mesh.git RUN mkdir -p /home/mesh/bbs/games
COPY ./ /home/mesh/bbs/
#### # Set working directory
WORKDIR /home/mesh/bbs
FROM --platform=$BUILDPLATFORM python:alpine # Copy project files including 'games' directory
COPY . /home/mesh/bbs/
# Switch to non-root user # Second stage: Final runtime environment
FROM python:alpine
# Add a non-root user for security
RUN adduser --disabled-password mesh RUN adduser --disabled-password mesh
USER mesh
# Ensure working directory
RUN mkdir -p /home/mesh/bbs RUN mkdir -p /home/mesh/bbs
WORKDIR /home/mesh/bbs WORKDIR /home/mesh/bbs
# Copy files from the build stage
COPY --from=build /home/mesh/bbs /home/mesh/bbs/
# Install Python dependencies # Install Python dependencies
COPY requirements.txt ./
RUN pip install --no-cache-dir --break-system-packages -r requirements.txt RUN pip install --no-cache-dir --break-system-packages -r requirements.txt
# Copy over app code # Ensure the 'games' directory exists in runtime container
COPY *.py ./ RUN mkdir -p /home/mesh/bbs/games
# Define config volume # Set user to mesh
VOLUME /home/mesh/bbs/config USER mesh
WORKDIR /home/mesh/bbs/config
COPY example_config.ini ./config.ini # Expose necessary ports
COPY fortunes.txt ./ EXPOSE 8080
# Start the server
CMD ["python", "server.py"]
# Define the command to run
ENTRYPOINT [ "python3", "/home/mesh/bbs/server.py" ]