Skip to content

Commit 9424d8d

Browse files
committed
build(api): docker image
1 parent fce5fde commit 9424d8d

File tree

5 files changed

+11
-17
lines changed

5 files changed

+11
-17
lines changed

api/Dockerfile

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
FROM python:3.11.3-slim-buster
22

3-
ENV PIP_DEFAULT_TIMEOUT=100 \
4-
GUNICORN_VERSION=20.1.0
5-
63
RUN apt-get update
74
# working with timezones
85
RUN apt-get install --no-install-recommends --yes tzdata
@@ -11,20 +8,7 @@ RUN apt-get install --no-install-recommends --yes librdkafka-dev python3-dev
118
# psycopg2 needs these
129
RUN apt-get install --no-install-recommends --yes build-essential libpq-dev
1310

14-
# upgrading pip solves many installation problems
15-
RUN pip3 install --upgrade pip
16-
RUN pip3 install "gunicorn==$GUNICORN_VERSION"
17-
18-
WORKDIR /app
19-
20-
# leverage Docker cache
21-
COPY requirements.lock ./
22-
RUN PYTHONDONTWRITEBYTECODE=1 pip install --no-cache-dir -r requirements.lock
23-
24-
COPY config.example.yml ./config.yml
25-
26-
ARG VCS_REVISION
27-
RUN echo "$VCS_REVISION" > ./version
11+
RUN --mount=source=dist,target=/dist PYTHONDONTWRITEBYTECODE=1 pip install --no-cache-dir /dist/*.whl
2812

2913
COPY src/rkapi .
3014

api/justfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ check: fmt-check lint test
2626

2727
# Build the docker image.
2828
image-build:
29+
rye build --wheel --clean
2930
docker build -t restknot-api:latest --build-arg VCS_REVISION=$(git rev-parse --short HEAD) .
3031

3132
# Run the container image.

api/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ dependencies = [
1717
"python-dotenv==1.0.0",
1818
"PyYAML==6.0",
1919
"requests==2.28.2",
20+
"gunicorn==20.1.0",
2021
]
2122
readme = "README.md"
2223
requires-python = ">= 3.11"

api/requirements-dev.lock

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ flask-cors==3.0.10
3030
# via rkapi
3131
flask-restful==0.3.9
3232
# via rkapi
33+
gunicorn==20.1.0
34+
# via rkapi
3335
idna==3.7
3436
# via requests
3537
iniconfig==2.0.0
@@ -64,6 +66,8 @@ pyyaml==6.0
6466
# via rkapi
6567
requests==2.28.2
6668
# via rkapi
69+
setuptools==72.1.0
70+
# via gunicorn
6771
six==1.16.0
6872
# via flask-cors
6973
# via flask-restful

api/requirements.lock

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ flask-cors==3.0.10
3030
# via rkapi
3131
flask-restful==0.3.9
3232
# via rkapi
33+
gunicorn==20.1.0
34+
# via rkapi
3335
idna==3.7
3436
# via requests
3537
itsdangerous==2.2.0
@@ -56,6 +58,8 @@ pyyaml==6.0
5658
# via rkapi
5759
requests==2.28.2
5860
# via rkapi
61+
setuptools==72.1.0
62+
# via gunicorn
5963
six==1.16.0
6064
# via flask-cors
6165
# via flask-restful

0 commit comments

Comments
 (0)