Private
Public Access
1
0
Files
madplaner/Dockerfile
Rasmus 88a82f887f
Some checks failed
Build and Push Madplaner / build (push) Failing after 21s
update dockerfile, css build and alpine images
2025-12-31 00:47:01 +01:00

34 lines
1.2 KiB
Docker

# --- STAGE 1: CSS Builder ---
FROM node:18-alpine AS css-builder
WORKDIR /app
COPY package*.json tailwind.config.js ./
COPY ./static/src/input.css ./static/src/input.css
COPY ./templates ./templates
RUN npm install && npx tailwindcss -i ./static/src/input.css -o ./static/dist/css/output.css --minify
# --- STAGE 2: Final App (Python) ---
# --- STAGE 2: Python Builder (Compile dependencies) ---
FROM python:3.11-alpine AS py-builder
WORKDIR /app
COPY requirements.txt .
# Install into a local folder to copy easily
RUN pip install --prefix=/install --no-cache-dir -r requirements.txt
# --- STAGE 3: Final Minimal Image ---
FROM python:3.11-alpine
WORKDIR /app
# Copy only the installed python packages from py-builder
COPY --from=py-builder /install /usr/local
# Copy only the compiled CSS from css-builder
COPY --from=css-builder /app/static/dist/css/output.css ./static/dist/css/output.css
# Copy application code
COPY . .
# Clean up any unneeded source files to save space
RUN rm -rf static/src tailwind.config.js package*.json requirements.txt
# Initialize DB, then start Gunicorn
CMD python -c "from app import app, db; app.app_context().push(); db.create_all()" && \
gunicorn --bind 0.0.0.0:5000 app:app