build: create development build and a separate production compose stack
This commit is contained in:
4 files changed
+115
-33
No files matched your search
+16
-20
@@ -1,35 +1,31 @@
|
||||
# --- Etap 1: budowa panelu ---------------------------------------------------
|
||||
FROM node:22-alpine AS frontend-build
|
||||
|
||||
# --- Frontend build ---------------------------------------------------------
|
||||
FROM node:22-alpine AS frontend-deps
|
||||
WORKDIR /frontend
|
||||
|
||||
COPY frontend/package.json frontend/package-lock.json ./
|
||||
RUN npm ci
|
||||
|
||||
FROM frontend-deps AS frontend-build
|
||||
COPY frontend/ ./
|
||||
RUN npm run build
|
||||
|
||||
# --- Etap 2: aplikacja -------------------------------------------------------
|
||||
FROM python:3.13-slim
|
||||
|
||||
# Zależności systemowe: opus dla głosu, ffmpeg do dekodowania audio
|
||||
RUN apt-get update && apt-get install -y \
|
||||
libopus0 \
|
||||
libopus-dev \
|
||||
ffmpeg \
|
||||
build-essential \
|
||||
# --- Python base ------------------------------------------------------------
|
||||
FROM python:3.13-slim AS python-base
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
libopus0 ffmpeg \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Zależności przed źródłami, aby korzystać z cache warstw.
|
||||
COPY requirements.txt .
|
||||
COPY requirements.txt ./requirements.txt
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# --- Development ------------------------------------------------------------
|
||||
FROM python-base AS dev
|
||||
RUN pip install --no-cache-dir ruff pytest
|
||||
EXPOSE 8000
|
||||
CMD ["python", "-u", "main.py"]
|
||||
|
||||
# --- Production -------------------------------------------------------------
|
||||
FROM python-base AS prod
|
||||
COPY . .
|
||||
COPY --from=frontend-build /frontend/dist /app/static
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
# Python serwuje API oraz zbudowany panel webowy.
|
||||
CMD ["python", "-u", "main.py"]
|
||||
Reference in new issue
Block a user