-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #107 from jabez007/docker_image_reduction
Reduce Docker image size
- Loading branch information
Showing
2 changed files
with
27 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 apk add --update --no-cache git python3 py3-pip | ||
RUN apt-get update && \ | ||
apt-get install -y \ | ||
git \ | ||
&& apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|
||
# Clone the repository | ||
RUN git clone https://github.com/TheCommsChannel/TC2-BBS-mesh.git | ||
|
||
# Install Python dependencies | ||
RUN pip install --no-cache-dir --break-system-packages -r /TC2-BBS-mesh/requirements.txt | ||
#### | ||
|
||
# Copy configuration script | ||
COPY configini.sh / | ||
FROM --platform=$BUILDPLATFORM python:alpine | ||
|
||
# Set permissions for configuration script | ||
RUN chmod +x /configini.sh | ||
# Switch to non-root user | ||
RUN adduser --disabled-password mesh | ||
USER mesh | ||
RUN mkdir -p /home/mesh/bbs | ||
WORKDIR /home/mesh/bbs | ||
|
||
# Define config volume | ||
VOLUME /config | ||
# Install Python dependencies | ||
COPY --from=build /TC2-BBS-mesh/requirements.txt ./ | ||
RUN pip install --no-cache-dir --break-system-packages -r requirements.txt | ||
|
||
# Define working directory | ||
WORKDIR /config | ||
# Copy over app code | ||
COPY --from=build /TC2-BBS-mesh/*.py ./ | ||
|
||
# Define config volume | ||
VOLUME /home/mesh/bbs/config | ||
WORKDIR /home/mesh/bbs/config | ||
COPY --from=build /TC2-BBS-mesh/example_config.ini ./config.ini | ||
COPY --from=build /TC2-BBS-mesh/fortunes.txt ./ | ||
|
||
# Define the command to run | ||
CMD ["sh", "-c", " /configini.sh && python3 /TC2-BBS-mesh/server.py"] | ||
ENTRYPOINT [ "python3", "/home/mesh/bbs/server.py" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters