mirrormanager2-container/Containerfile

67 lines
1.6 KiB
Plaintext
Raw Normal View History

2024-08-28 12:51:25 +00:00
# Stage 1: Build stage with necessary build dependencies
FROM quay.io/fedora/python-312:latest AS build-stage
LABEL \
name="python-312-with-rust" \
vendor="Fedora Infrastructure" \
license="MIT"
USER root
# Add RPM-only modules and build dependencies
RUN dnf install -y \
python3-pyrpmmd \
python3-poetry \
poetry \
cargo \
logrotate \
git \
gcc \
gcc-c++ \
libffi-devel \
openssl-devel
# Clone MirrorManager2 source code from the Git repo
RUN mkdir -p /opt/mirrormanager2
WORKDIR /opt/mirrormanager2
RUN git clone https://github.com/fedora-infra/mirrormanager2.git .
RUN pip install --prefix=/install .
# Stage 2: Final stage with runtime dependencies
FROM quay.io/fedora/python-312:latest
LABEL \
name="python-312-with-rust" \
vendor="Fedora Infrastructure" \
license="MIT"
USER root
# Add only runtime dependencies
RUN dnf install -y \
python3-pyrpmmd \
uwsgi \
uwsgi-plugin-python3 \
logrotate
# Copy installed dependencies from the build stage
COPY --from=build-stage /install /usr/
# Copy in the tree
#COPY --from=build-stage /opt/mirrormanager2 /opt/mirrormanager2
ADD run.py /opt/mirrormanager2/
# Set working directory
WORKDIR /opt/mirrormanager2
# Expose necessary ports
EXPOSE 5000
# Define entrypoint script to start the application
CMD [ "uwsgi", "--socket", "0.0.0.0:3031", \
"--uid", "uwsgi", \
"--plugins", "python3", \
"--protocol", "uwsgi", \
"--enable-threads", \
"--master", \
"-b", "65535", \
"--wsgi-file", "/opt/mirrormanager2/run.py" ]