mirror of
https://github.com/mruwnik/memory.git
synced 2025-06-28 23:24:43 +02:00
better api build
This commit is contained in:
parent
8855e8715a
commit
4049cf15b4
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,4 +1,5 @@
|
|||||||
memory_files
|
memory_files
|
||||||
|
venv
|
||||||
.env
|
.env
|
||||||
.DS_Store
|
.DS_Store
|
||||||
secrets/
|
secrets/
|
||||||
|
@ -1,14 +1,5 @@
|
|||||||
# Frontend build stage
|
# Backend base stage
|
||||||
FROM node:18-alpine AS frontend-builder
|
FROM python:3.11-slim AS backend-base
|
||||||
|
|
||||||
WORKDIR /frontend
|
|
||||||
COPY frontend/package*.json ./
|
|
||||||
RUN npm install
|
|
||||||
COPY frontend/ ./
|
|
||||||
RUN npm run build
|
|
||||||
|
|
||||||
# Backend build stage
|
|
||||||
FROM python:3.11-slim
|
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
@ -19,18 +10,30 @@ RUN apt-get update && apt-get install -y \
|
|||||||
python3-dev \
|
python3-dev \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Copy requirements files and setup
|
# Copy and install Python requirements
|
||||||
COPY requirements ./requirements/
|
COPY requirements ./requirements/
|
||||||
RUN mkdir src
|
RUN mkdir src
|
||||||
COPY setup.py ./
|
COPY setup.py ./
|
||||||
# Do an initial install to get the dependencies cached
|
# Do an initial install to get the dependencies cached
|
||||||
RUN pip install -e ".[api]"
|
RUN pip install -e ".[api]"
|
||||||
|
|
||||||
# Install the package with common dependencies
|
# Frontend build stage
|
||||||
|
FROM node:18-alpine AS frontend-builder
|
||||||
|
|
||||||
|
WORKDIR /frontend
|
||||||
|
COPY frontend/package*.json ./
|
||||||
|
RUN npm install
|
||||||
|
COPY frontend/ ./
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
# Final stage
|
||||||
|
FROM backend-base
|
||||||
|
|
||||||
|
# Install the package with Python source code
|
||||||
COPY src/ ./src/
|
COPY src/ ./src/
|
||||||
RUN pip install -e ".[api]"
|
RUN pip install -e ".[api]"
|
||||||
|
|
||||||
# Copy frontend build output from previous stage
|
# Copy frontend build output from frontend stage
|
||||||
COPY --from=frontend-builder /frontend/dist ./static/
|
COPY --from=frontend-builder /frontend/dist ./static/
|
||||||
|
|
||||||
# Run as non-root user
|
# Run as non-root user
|
||||||
|
Loading…
x
Reference in New Issue
Block a user