support Python 3.12

This commit is contained in:
sebthom
2023-10-14 23:11:02 +02:00
parent 7bcd88cbd6
commit a8ef6818b7
8 changed files with 556 additions and 442 deletions

View File

@@ -1,3 +1,7 @@
#syntax=docker/dockerfile:1.4
# see https://docs.docker.com/build/dockerfile/frontend/#dockerfile-frontend
# see https://github.com/moby/buildkit/blob/master/frontend/dockerfile/docs/reference.md#syntax
# see https://docs.docker.com/engine/reference/builder/#syntax
#
# Copyright (C) 2022 Sebastian Thomschke and contributors
# SPDX-License-Identifier: AGPL-3.0-or-later
@@ -8,45 +12,59 @@
######################
FROM debian:stable-slim as runtime-base-image
LABEL maintainer="Sebastian Thomschke"
ARG DEBIAN_FRONTEND=noninteractive
ARG LC_ALL=C
RUN set -eu \
#
&& apt-get update -y \
&& echo "#################################################" \
&& echo "Install Chromium + Driver..." \
&& echo "#################################################" \
&& apt-get install --no-install-recommends -y chromium chromium-driver \
#
&& rm -rf \
SHELL ["/bin/bash", "-euo", "pipefail", "-c"]
RUN <<EOF
apt-get update
echo "#################################################"
echo "Install Chromium + Driver..."
echo "#################################################"
apt-get install --no-install-recommends -y chromium chromium-driver
apt-get clean autoclean
apt-get autoremove --purge -y
rm -rf \
/var/cache/{apt,debconf} \
/var/lib/apt/lists/* \
/var/log/{apt,alternatives.log,bootstrap.log,dpkg.log} \
/tmp/* /var/tmp/*
EOF
######################
# build image
######################
# https://hub.docker.com/_/python?tab=tags&name=3-slim
FROM python:3-slim AS build-image
# https://hub.docker.com/_/python/tags?name=3-slim
FROM python:3.12-slim AS build-image
RUN apt-get update \
# install required libraries
&& apt-get install --no-install-recommends -y \
ARG DEBIAN_FRONTEND=noninteractive
ARG LC_ALL=C
SHELL ["/bin/bash", "-euo", "pipefail", "-c"]
RUN <<EOF
apt-get update
# install required libraries
apt-get install --no-install-recommends -y \
binutils `# required by pyinstaller` \
build-essential `# required by transitive dependency "wrapt"` \
git `# required by pdm to generate app version` \
#
# upgrade pip
&& python -m pip install --upgrade pip \
#
# install pdm
&& pip install pdm
# upgrade pip
python -m pip install --upgrade pip \
# install pdm
pip install pdm
EOF
ENV PATH="/opt/upx:${PATH}"
@@ -54,12 +72,16 @@ COPY kleinanzeigen_bot /opt/app/kleinanzeigen_bot
COPY .git /opt/app/.git
COPY README.md pdm.lock pyinstaller.spec pyproject.toml /opt/app/
RUN cd /opt/app \
&& ls -la . \
&& pdm install -v \
&& ls -la kleinanzeigen_bot \
&& pdm run compile \
&& ls -l dist
RUN <<EOF
cd /opt/app
ls -la .
pdm install -v
ls -la kleinanzeigen_bot
pdm run compile
ls -l dist
EOF
RUN /opt/app/dist/kleinanzeigen-bot --help
@@ -76,10 +98,16 @@ ARG GIT_COMMIT_DATE
ARG GIT_REPO_URL
LABEL \
maintainer="Sebastian Thomschke" \
org.label-schema.schema-version="1.0" \
org.label-schema.build-date=$BUILD_DATE \
org.label-schema.vcs-ref=$GIT_COMMIT_HASH \
org.label-schema.vcs-url=$GIT_REPO_URL
org.label-schema.vcs-url=$GIT_REPO_URL \
org.opencontainers.image.authors="Sebastian Thomschke" \
org.opencontainers.image.vendor="Sebastian Thomschke" \
org.opencontainers.image.licenses="AGPL-3.0" \
org.opencontainers.image.title="kleinanzeigen-bot" \
org.opencontainers.image.description="CLI application to ease publishing of ads to kleinanzeigen.de"
# https://stackoverflow.com/a/59812588/5116073
ENV PYTHONUNBUFFERED=1