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

Improve docker deployment by using multi stage building #158

Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/backend-tests-database-blob.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
run_tests_blob_architecture:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
run_tests_streaming_serverless:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -28,7 +28,7 @@ jobs:
pip install -r requirements-test.txt

- name: Run tests Streaming Serverless/Lambda function Architecture
working-directory: Backend/
working-directory: Backend
run: |
python -m pytest tests/
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/frontend-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
build:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest

steps:
- name: Check out code
Expand Down
17 changes: 12 additions & 5 deletions Backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@

FROM python:3.11-slim
FROM python:3.11-slim AS builder

WORKDIR /code
COPY ./requirements.txt /code/requirements.txt
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt

RUN python -m pip wheel -r requirements.txt --no-cache-dir --no-deps --wheel-dir /wheels

FROM python:3.11-slim AS runner

WORKDIR /code
COPY --from=builder /wheels /wheels

RUN python -m pip install --no-cache-dir /wheels/* && rm -r /wheels
COPY ./app /code/app

WORKDIR /code/
CMD ["python", "-m", "app"]
ENTRYPOINT [ "python", "-m", "app" ]
EXPOSE 8000

#CMD ["tail", "-f", "/dev/null"]

#docker build -t spotify_electron_backend_image .
Expand Down
Loading