docker
This commit is contained in:
@@ -0,0 +1 @@
|
||||
'''docker files for the project'''
|
||||
@@ -0,0 +1,60 @@
|
||||
name: excel-project
|
||||
|
||||
services:
|
||||
backend-dev:
|
||||
profiles: ["dev"]
|
||||
image: "${DOCKER_REGISTRY:-local}/excel-dev:${IMAGE_TAG:-local}"
|
||||
container_name: backend-dev
|
||||
build:
|
||||
dockerfile: ./docker/dockerfile
|
||||
context: ../
|
||||
target: dev
|
||||
init: true #Manage processes and reap zombies
|
||||
ipc: private #Inter-Process Communication (IPC) namespace for high-performance applications
|
||||
volumes:
|
||||
- type: bind
|
||||
source: ../src
|
||||
target: /home/excel-project/src
|
||||
- type: bind
|
||||
source: ../main.py
|
||||
target: /home/excel-project/main.py
|
||||
- type: bind
|
||||
source: ../configs
|
||||
target: /home/excel-project/configs
|
||||
- type: bind
|
||||
source: ../DB
|
||||
target: /home/excel-project/DB
|
||||
networks:
|
||||
- backend
|
||||
ports:
|
||||
- "80:8000"
|
||||
entrypoint:
|
||||
- python3
|
||||
- main.py
|
||||
|
||||
backend-prod:
|
||||
profiles: ["prod"]
|
||||
image: "${DOCKER_REGISTRY:-local}/excel-prod:${IMAGE_TAG:-local}"
|
||||
container_name: backend-prod
|
||||
build:
|
||||
dockerfile: ./docker/dockerfile
|
||||
context: ../
|
||||
target: prod
|
||||
init: true #Manage processes and reap zombies
|
||||
ipc: private #Inter-Process Communication (IPC) namespace for high-performance applications
|
||||
volumes:
|
||||
- type: bind
|
||||
source: ../configs
|
||||
target: /home/excel-project/configs
|
||||
- type: bind
|
||||
source: ../DB
|
||||
target: /home/excel-project/DB
|
||||
networks:
|
||||
- backend
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "80:8000"
|
||||
|
||||
networks:
|
||||
backend:
|
||||
name: "${BACKEND_NETWORK:-backend_network}"
|
||||
@@ -0,0 +1,37 @@
|
||||
# --- Stage 1: Python Backend dev ---
|
||||
FROM python:3.14-slim AS dev
|
||||
|
||||
LABEL org.opencontainers.image.title="the-great-excel-project-dev"
|
||||
LABEL org.opencontainers.image.source="https://git.homyk.space/MH.Dmitrii/The_Great_Excel_Project"
|
||||
|
||||
WORKDIR /home/excel-project
|
||||
|
||||
COPY pyproject.toml poetry.lock ./
|
||||
|
||||
RUN pip install --no-cache-dir --break-system-packages poetry \
|
||||
&& poetry config virtualenvs.create false \
|
||||
&& poetry install --no-root --no-interaction
|
||||
|
||||
# --- Stage 2: Python Backend prod ---
|
||||
|
||||
FROM python:3.14-slim AS prod
|
||||
|
||||
LABEL org.opencontainers.image.title="the-great-excel-project-prod"
|
||||
LABEL org.opencontainers.image.source="https://git.homyk.space/MH.Dmitrii/The_Great_Excel_Project"
|
||||
|
||||
WORKDIR /home/excel-project
|
||||
|
||||
COPY pyproject.toml poetry.lock main.py ./
|
||||
COPY src/ ./src/
|
||||
|
||||
RUN pip install --no-cache-dir --break-system-packages poetry \
|
||||
&& poetry config virtualenvs.create false \
|
||||
&& poetry install --no-root --no-interaction --only main
|
||||
|
||||
RUN groupadd --gid 1000 appuser \
|
||||
&& useradd --uid 1000 --gid appuser --shell /bin/bash --create-home appuser \
|
||||
&& chown -R appuser:appuser /home/excel-project
|
||||
|
||||
USER appuser
|
||||
|
||||
ENTRYPOINT ["python3", "main.py"]
|
||||
Reference in New Issue
Block a user