feat: rework to use next and host from single dockerfile

This commit is contained in:
Lucas Oskorep
2026-01-20 21:48:33 -05:00
parent dae0625278
commit 28a84293c9
44 changed files with 7592 additions and 10664 deletions

45
docker/Dockerfile Normal file
View File

@@ -0,0 +1,45 @@
# Stage 1: Build the Next.js frontend
FROM docker.io/library/node:24-alpine AS frontend-builder
LABEL authors="lucasoskorep"
WORKDIR /build/mta-sign-ui
# Enable corepack for pnpm
RUN corepack enable && corepack prepare pnpm@10.28.1 --activate
# Copy package files first for better caching
COPY mta-sign-ui/package.json mta-sign-ui/pnpm-lock.yaml* ./
# Install dependencies (use frozen-lockfile if lock exists, otherwise generate)
RUN pnpm install
# Copy the rest of the frontend source
COPY mta-sign-ui/ ./
# Build the static export (outputs to 'out' directory)
RUN pnpm build
# Stage 2: Python backend with frontend static files
FROM ghcr.io/astral-sh/uv:python3.13-bookworm
LABEL authors="lucasoskorep"
WORKDIR /app
# Copy dependency files and install dependencies only (not the project itself)
COPY pyproject.toml uv.lock README.md ./
RUN uv sync --frozen --no-dev --no-install-project
# Copy source code
COPY mta_api_client ./mta_api_client
COPY mta_sign_server ./mta_sign_server
COPY main.py stops.txt ./
# Copy the built frontend from the first stage
COPY --from=frontend-builder /build/mta-sign-ui/out ./static
# Now install the project
RUN uv sync --frozen --no-dev
EXPOSE 8000
ENTRYPOINT ["uv", "run", "python", "main.py"]

View File

@@ -1,23 +0,0 @@
FROM docker.io/library/python:3.11
LABEL authors="lucasoskorep"
WORKDIR /app
RUN apt-get update
RUN apt-get install -y \
build-essential \
curl
# Needed when building for obscure cpu architectures
#RUN curl https://sh.rustup.rs -sSf | bash -s -- -y
#ENV PATH="/root/.cargo/bin:${PATH}"
#RUN cargo
RUN pip install poetry
COPY ../pyproject.toml poetry.lock ./
RUN poetry install --without dev
COPY ../mta_api_client ./
COPY ../mta_sign_server ./
COPY ../main.py stops.txt ./
ENTRYPOINT ["poetry", "run", "python", "-m", "main.py"]

View File

@@ -1,13 +0,0 @@
FROM docker.io/library/node:21-alpine
LABEL authors="lucasoskorep"
WORKDIR /app
COPY mta-sign-ui/* .
RUN corepack enable
RUN yarn set version stable
RUN yarn --version
RUN yarn