Skip to content

Commit

Permalink
feat(docker): sync src on dev mode
Browse files Browse the repository at this point in the history
  • Loading branch information
YuevUwU committed Dec 1, 2024
1 parent 19129ae commit 03469a6
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
10 changes: 10 additions & 0 deletions .docker/bot/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

FROM python:3.11-slim-bullseye AS development

WORKDIR /app

COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages
COPY --from=builder /usr/local/bin /usr/local/bin

CMD ["python3", "main.py"]


FROM python:3.11-slim-bullseye AS production

WORKDIR /app
Expand Down
2 changes: 0 additions & 2 deletions .docker/web/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ WORKDIR /app
COPY --from=builder /usr/local/bin /usr/local/bin
COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages

COPY . .

ENV FLASK_APP=app.py
ENV FLASK_ENV=development
ENV FLASK_RUN_PORT=5000
Expand Down
4 changes: 4 additions & 0 deletions docker-compose.prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@ include: docker-compose.yaml

services:
web:
volumes:
target: production
bot:
volumes:
target: production
6 changes: 5 additions & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ services:
restart: unless-stopped
ports:
- ${FLASK_HOST_PORT}:5000
volumes:
- .:/app
networks:
- backnet
- frontnet
Expand All @@ -41,8 +43,10 @@ services:
build:
context: .
dockerfile: .docker/bot/Dockerfile
target: production
target: development
restart: unless-stopped
volumes:
- .:/app
networks:
- backnet
depends_on:
Expand Down

0 comments on commit 03469a6

Please sign in to comment.