diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 73e9f81..b07d02b 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -28,3 +28,4 @@ jobs: push: true tags: gylfirst/chouettebot:latest,gylfirst/chouettebot:v0.0.${{ github.run_number }} platforms: linux/amd64, linux/arm/v6, linux/arm/v7, linux/arm64/v8, linux/386, linux/ppc64le, linux/s390x + target: prod diff --git a/Dockerfile b/Dockerfile index 1110005..e234541 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,18 @@ # Dockerfile for the python discord bot - -FROM python:3.12-alpine +ARG PYTHON_VERSION=3.12 +FROM python:${PYTHON_VERSION}-alpine as build WORKDIR /usr/src/chouettebot - COPY . . -RUN pip --no-cache-dir install -r requirements.txt + +RUN wget -O - https://sh.rustup.rs | sh -s -- -y && \ + PATH=$PATH:$HOME/.cargo/bin && \ + python3 -m venv venv && venv/bin/pip --no-cache-dir install -r requirements.txt + +FROM python:${PYTHON_VERSION}-alpine as prod + +WORKDIR /usr/src/chouettebot +COPY --from=build /usr/src/chouettebot ./ EXPOSE 8080 -CMD ["python3", "main.py"] +CMD ["venv/bin/python3", "main.py"]