diff --git a/docker-example/Dockerfile b/docker-example/Dockerfile index 2c36c822..da1a39b0 100644 --- a/docker-example/Dockerfile +++ b/docker-example/Dockerfile @@ -11,21 +11,23 @@ COPY . . # Create virtualenv which will be copied into final container ENV VIRTUAL_ENV=/app/.venv ENV PATH="$VIRTUAL_ENV/bin:$PATH" -RUN python3.11 -m venv $VIRTUAL_ENV - -# Install app requirements and nextpy inside virtualenv -RUN pip install -r requirements.txt - -# Deploy templates and prepare app -RUN nextpy init - -# Export static copy of frontend to /app/.web/_static -RUN nextpy export --frontend-only --no-zip - -# Copy static files out of /app to save space in backend image -RUN mv .web/_static /tmp/_static -RUN rm -rf .web && mkdir .web -RUN mv /tmp/_static .web/_static +RUN \ + python3.11 -m venv $VIRTUAL_ENV && \ + + # Install app requirements and nextpy inside virtualenv + pip install --no-cache-dir -r requirements.txt && \ + + # Deploy templates and prepare app + nextpy init && \ + + # Export static copy of frontend to /app/.web/_static + nextpy export --frontend-only --no-zip && \ + + # Copy static files out of /app to save space in backend image + mv .web/_static /tmp/_static && \ + rm -rf .web && \ + mkdir .web && \ + mv /tmp/_static .web/_static # Stage 2: copy artifacts into slim image FROM python:3.11-slim