Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimised dokerfile for backend and added .dockerignore #73

Merged
merged 3 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions backend/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
*.pyc
*.pyo
__pycache__/
venv/
env/
*.vscode/
.idea/
*.swp
.DS_Store
Thumbs.db
.git/
.gitignore
images/
*.log
*.pid
run.bat
run-server.ps1
23 changes: 15 additions & 8 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,31 @@
FROM python:3.10.12-slim
FROM python:3.10.12-slim AS build

WORKDIR /app

RUN apt-get update && apt-get install -y \
RUN apt-get update && apt-get install -y --no-install-recommends \
libgl1-mesa-glx \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*

COPY requirements.txt /app/requirements.txt
COPY requirements.txt /app/

FROM python:3.10.12-slim

WORKDIR /app

RUN apt-get update && apt-get install -y --no-install-recommends \
libgl1-mesa-glx \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*

COPY requirements.txt /app/
RUN pip install --no-cache-dir -r requirements.txt
RUN pip uninstall uvcorn

COPY . /app
COPY . /app/

RUN chmod +x run.sh
RUN mkdir ../images
RUN chmod +x run.sh && mkdir -p ../images

EXPOSE 8000

ENV WORKERS=1

CMD ["./run.sh"]