mirror of
https://github.com/wahyd4/links.git
synced 2026-08-09 05:06:16 +10:00
Update docker
This commit is contained in:
+15
-5
@@ -22,7 +22,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
npm \
|
||||
gettext \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& apt-get clean
|
||||
&& apt-get clean \
|
||||
&& npm cache clean --force
|
||||
|
||||
# Copy uv binary
|
||||
COPY --from=uv /usr/local/bin/uv /usr/local/bin/uv
|
||||
@@ -47,9 +48,10 @@ COPY static/ ./static/
|
||||
RUN uv run manage.py tailwind install \
|
||||
&& uv run manage.py tailwind build \
|
||||
&& uv run manage.py collectstatic --noinput \
|
||||
&& uv run manage.py compilemessages --locale=zh_Hans
|
||||
&& uv run manage.py compilemessages --locale=zh_Hans \
|
||||
&& rm -rf /app/new_theme/static_src/node_modules
|
||||
|
||||
# Install Playwright and browsers
|
||||
# Install Playwright and browsers (chromium-headless-shell only, no full chromium)
|
||||
ENV PLAYWRIGHT_BROWSERS_PATH=/app/.playwright
|
||||
RUN uv run playwright install chromium --with-deps
|
||||
|
||||
@@ -60,7 +62,12 @@ RUN rm -rf /tmp/.cache/uv ~/.npm ~/.cache \
|
||||
&& find /app -type f -name "*.md" -delete \
|
||||
&& find /app -type f -name "*.txt" ! -name "requirements.txt" -delete \
|
||||
&& rm -rf /app/.venv/lib/python3.12/site-packages/pip \
|
||||
&& rm -rf /app/.venv/lib/python3.12/site-packages/setuptools
|
||||
&& rm -rf /app/.venv/lib/python3.12/site-packages/setuptools \
|
||||
&& rm -rf /app/.playwright/chromium-* \
|
||||
&& rm -rf /app/.playwright/ffmpeg-* \
|
||||
&& find /app/.venv -name "*.so" -exec strip {} + 2>/dev/null || true \
|
||||
&& find /app/.venv -type d -name "test*" -exec rm -rf {} + 2>/dev/null || true \
|
||||
&& find /app/.venv -type d -name "*test" -exec rm -rf {} + 2>/dev/null || true
|
||||
|
||||
# Production stage - use Python 3.12 slim
|
||||
FROM python:3.12-slim AS production
|
||||
@@ -104,7 +111,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
libasound2 \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /tmp/* /var/tmp/*
|
||||
&& rm -rf /tmp/* /var/tmp/* \
|
||||
&& rm -rf /usr/share/doc/* \
|
||||
&& rm -rf /usr/share/man/*
|
||||
|
||||
# Create non-root user and directories
|
||||
RUN useradd -m -u 1000 appuser \
|
||||
@@ -113,6 +122,7 @@ RUN useradd -m -u 1000 appuser \
|
||||
&& chown -R appuser:appuser /app
|
||||
|
||||
# Copy only the virtual environment and built assets from builder
|
||||
COPY --from=builder /usr/local/bin/uv /usr/local/bin/uv
|
||||
COPY --from=builder --chown=appuser:appuser /app/.venv /app/.venv
|
||||
COPY --from=builder --chown=appuser:appuser /app/.playwright /app/.playwright
|
||||
COPY --from=builder --chown=appuser:appuser /app/staticfiles /app/staticfiles
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user