File tree 5 files changed +434
-239
lines changed 5 files changed +434
-239
lines changed Original file line number Diff line number Diff line change 1
1
.github /
2
2
.gitignore
3
3
config.example.yaml
4
- poetry.lock
5
- pyproject.toml
6
4
readme.md
7
5
renovate.json
Original file line number Diff line number Diff line change 1
1
# Copyright (c) NiceBots.xyz
2
2
# SPDX-License-Identifier: MIT
3
3
4
- # For more information, please refer to https://aka.ms/vscode-docker-python
5
- FROM python:3.12-slim-bookworm
4
+ ARG PYTHON_VERSION=3.12
5
+ ARG NODE_VERSION=20
6
+ FROM python:${PYTHON_VERSION}-slim-bookworm AS python-base
6
7
7
- # Keeps Python from generating .pyc files in the container
8
8
ENV PYTHONDONTWRITEBYTECODE=1
9
-
10
- # Turns off buffering for easier container logging
11
9
ENV PYTHONUNBUFFERED=1
12
10
13
- # we move to the app folder and run the pip install command
11
+ RUN pip install -U pdm
12
+ ENV PDM_CHECK_UPDATE=false
13
+
14
14
WORKDIR /app
15
+ COPY src pyproject.toml pdm.lock ./
15
16
16
- ENV PYTHONUNBUFFERED 1
17
- ENV PYTHONDONTWRITEBYTECODE 1
17
+ RUN pdm export --prod -o requirements.txt
18
18
19
- # we copy just the requirements.txt first to leverage Docker cache
20
- COPY requirements.txt .
19
+ FROM python:${PYTHON_VERSION}-slim-bookworm AS app
21
20
22
- # Install pip requirements
23
- RUN pip install -r requirements.txt
21
+ ENV PYTHONDONTWRITEBYTECODE=1
22
+ ENV PYTHONUNBUFFERED=1
23
+
24
+ WORKDIR /app
24
25
25
- # Creates a non-root user with an explicit UID and adds permission to access the /app folder
26
26
RUN adduser -u 6392 --disabled-password --gecos "" appuser && chown -R appuser /app
27
- USER appuser
28
27
29
- # We copy the rest of the codebase into the image
30
- COPY ./ /app/
28
+ COPY --from=python-base --chown=appuser /app/requirements.txt ./
29
+ COPY src/ ./src
30
+ COPY LICENSE ./
31
+
32
+ RUN pip install -r requirements.txt --require-hashes
33
+ USER appuser
31
34
32
- # We run the application
33
- CMD ["python" , "src" ]
35
+ CMD ["python" , "src" ]
You can’t perform that action at this time.
0 commit comments