mirror of
https://github.com/grillazz/fastapi-sqlalchemy-asyncpg.git
synced 2025-11-30 13:20:40 +03:00
Merge pull request #228 from grillazz/docker-image-refactor
Docker image refactor
This commit is contained in:
8
.github/workflows/build-and-test.yml
vendored
8
.github/workflows/build-and-test.yml
vendored
@@ -34,7 +34,7 @@ jobs:
|
|||||||
ports:
|
ports:
|
||||||
- 6379:6379
|
- 6379:6379
|
||||||
sqldb:
|
sqldb:
|
||||||
image: postgres:16
|
image: postgres:17
|
||||||
env:
|
env:
|
||||||
POSTGRES_USER: panettone
|
POSTGRES_USER: panettone
|
||||||
POSTGRES_PASSWORD: secret
|
POSTGRES_PASSWORD: secret
|
||||||
@@ -45,12 +45,12 @@ jobs:
|
|||||||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
|
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v5
|
||||||
- name: Create database schema
|
- name: Create database schema
|
||||||
run: PGPASSWORD=secret psql -h 127.0.0.1 -d testdb -U panettone -c "CREATE SCHEMA shakespeare; CREATE SCHEMA happy_hog;"
|
run: PGPASSWORD=secret psql -h 127.0.0.1 -d testdb -U panettone -c "CREATE SCHEMA shakespeare; CREATE SCHEMA happy_hog;"
|
||||||
|
|
||||||
- name: Install the latest version of uv and set the python version
|
- name: Install the latest version of uv
|
||||||
uses: astral-sh/setup-uv@v5
|
uses: astral-sh/setup-uv@v7
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
|
|
||||||
|
|||||||
21
Dockerfile
21
Dockerfile
@@ -1,14 +1,11 @@
|
|||||||
FROM ubuntu:25.10 AS base
|
FROM python:3.14-slim AS base
|
||||||
|
|
||||||
RUN apt-get update -qy \
|
RUN apt-get update -qy \
|
||||||
&& apt-get install -qyy \
|
&& apt-get install -qyy \
|
||||||
-o APT::Install-Recommends=false \
|
-o APT::Install-Recommends=false \
|
||||||
-o APT::Install-Suggests=false \
|
-o APT::Install-Suggests=false \
|
||||||
build-essential \
|
build-essential \
|
||||||
ca-certificates \
|
ca-certificates
|
||||||
python3-setuptools \
|
|
||||||
python3.14-dev
|
|
||||||
|
|
||||||
|
|
||||||
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
||||||
|
|
||||||
@@ -22,25 +19,13 @@ COPY uv.lock /_lock/
|
|||||||
|
|
||||||
RUN cd /_lock && uv sync --locked --no-install-project
|
RUN cd /_lock && uv sync --locked --no-install-project
|
||||||
##########################################################################
|
##########################################################################
|
||||||
FROM ubuntu:25.10
|
FROM python:3.14-slim
|
||||||
|
|
||||||
ENV PATH=/panettone/bin:$PATH
|
ENV PATH=/panettone/bin:$PATH
|
||||||
|
|
||||||
RUN groupadd -r panettone
|
RUN groupadd -r panettone
|
||||||
RUN useradd -r -d /panettone -g panettone -N panettone
|
RUN useradd -r -d /panettone -g panettone -N panettone
|
||||||
|
|
||||||
STOPSIGNAL SIGINT
|
|
||||||
|
|
||||||
RUN apt-get update -qy && apt-get install -qyy \
|
|
||||||
-o APT::Install-Recommends=false \
|
|
||||||
-o APT::Install-Suggests=false \
|
|
||||||
python3.14 \
|
|
||||||
libpython3.14 \
|
|
||||||
libpcre3
|
|
||||||
|
|
||||||
RUN apt-get clean
|
|
||||||
RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
|
||||||
|
|
||||||
COPY --from=base --chown=panettone:panettone /panettone /panettone
|
COPY --from=base --chown=panettone:panettone /panettone /panettone
|
||||||
|
|
||||||
USER panettone
|
USER panettone
|
||||||
|
|||||||
Reference in New Issue
Block a user