40 lines
1.1 KiB
Docker
40 lines
1.1 KiB
Docker
FROM debian:trixie-slim
|
|
|
|
RUN apt-get update && \
|
|
apt-get install -y --no-install-recommends \
|
|
apt-mirror \
|
|
cron \
|
|
nginx \
|
|
xz-utils \
|
|
ca-certificates \
|
|
liblwp-protocol-https-perl && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
# Create mirror directory with proper ownership
|
|
RUN mkdir -p /mirror && \
|
|
chown -R apt-mirror:apt-mirror /mirror
|
|
|
|
# Copy user-provided mirror.list at build time
|
|
COPY mirror.list /etc/apt/mirror.list
|
|
|
|
# Configure cron job for daily sync at 02:00 UTC
|
|
RUN echo "0 2 * * * apt-mirror > /var/log/apt-mirror.log 2>&1" | crontab -u apt-mirror -
|
|
|
|
COPY nginx.conf /etc/nginx/sites-available/mirror
|
|
# Create directories explicitly before linking
|
|
RUN mkdir -p /etc/nginx/sites-available /etc/nginx/sites-enabled && \
|
|
ln -s /etc/nginx/sites-available/mirror /etc/nginx/sites-enabled/mirror && \
|
|
rm -f /etc/nginx/sites-enabled/default
|
|
|
|
# Entrypoint handles initial sync and starts cron in foreground
|
|
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
|
RUN chmod +x /usr/local/bin/entrypoint.sh
|
|
|
|
VOLUME ["/mirror"]
|
|
WORKDIR /mirror
|
|
|
|
USER apt-mirror
|
|
EXPOSE 80
|
|
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
|
|