Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Dockerfile #156

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 17 additions & 15 deletions docker-example/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading