mirror of
https://github.com/TheCommsChannel/TC2-BBS-mesh.git
synced 2025-03-13 10:56:30 -04:00
Update Dockerfile to reduce image size
This commit is contained in:
parent
6d7e1f4ad2
commit
d313953f8b
@ -1,25 +1,36 @@
|
|||||||
FROM alpine:latest
|
# From original Dockerfile at https://github.com/TheCommsChannel/TC2-BBS-mesh
|
||||||
|
FROM debian:stable-slim AS build
|
||||||
|
|
||||||
# Install required packages
|
RUN apt-get update && \
|
||||||
RUN apk add --update --no-cache git python3 py3-pip
|
apt-get install -y \
|
||||||
|
git \
|
||||||
|
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Clone the repository
|
# Clone the repository
|
||||||
RUN git clone https://github.com/TheCommsChannel/TC2-BBS-mesh.git
|
RUN git clone https://github.com/TheCommsChannel/TC2-BBS-mesh.git
|
||||||
|
|
||||||
|
####
|
||||||
|
|
||||||
|
FROM --platform=$BUILDPLATFORM python:alpine
|
||||||
|
|
||||||
|
# Switch to non-root user
|
||||||
|
RUN adduser --disabled-password mesh
|
||||||
|
USER mesh
|
||||||
|
RUN mkdir -p /home/mesh/bbs
|
||||||
|
WORKDIR /home/mesh/bbs
|
||||||
|
|
||||||
# Install Python dependencies
|
# Install Python dependencies
|
||||||
RUN pip install --no-cache-dir --break-system-packages -r /TC2-BBS-mesh/requirements.txt
|
COPY --from=build /TC2-BBS-mesh/requirements.txt ./
|
||||||
|
RUN pip install --no-cache-dir --break-system-packages -r requirements.txt
|
||||||
|
|
||||||
# Copy configuration script
|
# Copy over app code
|
||||||
COPY configini.sh /
|
COPY --from=build /TC2-BBS-mesh/*.py ./
|
||||||
|
|
||||||
# Set permissions for configuration script
|
|
||||||
RUN chmod +x /configini.sh
|
|
||||||
|
|
||||||
# Define config volume
|
# Define config volume
|
||||||
VOLUME /config
|
VOLUME /home/mesh/bbs/config
|
||||||
|
WORKDIR /home/mesh/bbs/config
|
||||||
# Define working directory
|
COPY --from=build /TC2-BBS-mesh/example_config.ini ./config.ini
|
||||||
WORKDIR /config
|
COPY --from=build /TC2-BBS-mesh/fortunes.txt ./
|
||||||
|
|
||||||
# Define the command to run
|
# Define the command to run
|
||||||
CMD ["sh", "-c", " /configini.sh && python3 /TC2-BBS-mesh/server.py"]
|
ENTRYPOINT [ "python3", "/home/mesh/bbs/server.py" ]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user