Skip to content

Commit 108a46f

Browse files
committed
bump to python 3.11
1 parent 6d9d859 commit 108a46f

File tree

14 files changed

+83
-62
lines changed

14 files changed

+83
-62
lines changed

.devcontainer/devcontainer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
// Update 'VARIANT' to pick a Python version: 3, 3.10, 3.9, 3.8, 3.7, 3.6
1010
// Append -bullseye or -buster to pin to an OS version.
1111
// Use -bullseye variants on local on arm64/Apple Silicon.
12-
"VARIANT": "3.10",
12+
"VARIANT": "3.11",
1313
// Options
1414
// "NODE_VERSION": "lts/*",
15-
"POETRY_VERSION": "1.5.1"
15+
"POETRY_VERSION": "1.7.1"
1616
}
1717
},
1818
// Set *default* container specific settings.json values on container create.

.github/actions/setup-poetry-action/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ inputs:
88
python-version:
99
required: false
1010
type: string
11-
default: 3.10
11+
default: 3.11
1212
install-dependencies:
1313
required: false
1414
type: boolean

.github/workflows/release.yml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ on:
99
pull_request:
1010

1111
env:
12-
PYTHON_VERSION: '3.10'
13-
POETRY_VERSION: 1.5.1
12+
PYTHON_VERSION: '3.11'
13+
POETRY_VERSION: 1.7.1
1414

1515
jobs:
1616
docker-images:
@@ -33,13 +33,6 @@ jobs:
3333
context: ./
3434
steps:
3535
- uses: actions/checkout@v3
36-
- uses: ./.github/actions/setup-poetry-action
37-
with:
38-
poetry-version: ${{ env.POETRY_VERSION }}
39-
python-version: ${{ env.PYTHON_VERSION }}
40-
install-dependencies: false
41-
- name: Export requirements.txt
42-
run: poetry export -f requirements.txt --output requirements.txt
4336
- uses: docker/metadata-action@v4
4437
id: meta
4538
with:

.github/workflows/tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
pull_request:
55

66
env:
7-
POETRY_VERSION: 1.5.1
7+
POETRY_VERSION: 1.7.1
88

99
jobs:
1010
tests:
@@ -14,7 +14,7 @@ jobs:
1414
fail-fast: false
1515
matrix:
1616
os: [ubuntu-latest, windows-latest, macos-latest]
17-
python: ['3.9', '3.10', '3.11']
17+
python: ['3.9', '3.10', '3.11', '3.12']
1818
steps:
1919
- uses: actions/checkout@v3
2020
- uses: ./.github/actions/setup-poetry-action

.github/workflows/tgtg.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ on:
55
- cron: 0 1 * * *
66

77
env:
8-
PYTHON_VERSION: '3.10'
9-
POETRY_VERSION: 1.5.1
8+
PYTHON_VERSION: '3.11'
9+
POETRY_VERSION: 1.7.1
1010

1111
jobs:
1212
test:

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,5 @@ executable:
2323
zip -j ./dist/scanner.zip ./dist/*
2424

2525
images:
26-
poetry export -f requirements.txt --output requirements.txt
2726
docker build -f ./docker/Dockerfile -t tgtg-scanner:latest .
2827
docker build -f ./docker/Dockerfile.alpine -t tgtg-scanner:latest-alpine .

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ My preferred method for servers, NAS, and RapsberryPis is using the pre-build mu
7777
[Docker Hub](https://hub.docker.com/r/derhenning/tgtg).
7878
The images are built for Linux on `amd64`, `arm64`, `armv7`, `armv6`, and `i386`.
7979

80-
1. Install Docker and docker-compose
80+
1. Install Docker
8181
2. Copy and edit `docker-compose.yml` as described in the
8282
[Wiki](https://github.com/Der-Henning/tgtg/wiki/Configuration)
83-
3. Run `docker-compose up -d`
83+
3. Run `docker compose up -d`
8484

8585
The container automatically creates a volume mounting `\tokens`
8686
where the app saves the TGTG credentials after login.

docker-compose.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@ version: '3.3'
22

33
services:
44
scanner:
5-
image: derhenning/tgtg:latest-alpine ## pre build image from docker hub
6-
#image: tgtg-scanner:latest ## locally build image
5+
image: derhenning/tgtg:latest-alpine ## pre build image from docker hub
6+
# image: tgtg-scanner:latest ## locally build image
7+
# build: ## build image with compose
8+
# context: .
9+
# dockerfile: docker/Dockerfile.alpine
710
environment:
811
# Configuration via environment variables.
912
# Basic example using Telegram notifications

docker/Dockerfile

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,47 @@
1-
FROM python:3.10-slim
1+
FROM python:3.11-slim as base
22

33
ENV PYTHONUNBUFFERED=1 \
44
PYTHONDONTWRITEBYTECODE=1 \
55
PIP_NO_CACHE_DIR=off \
66
PIP_DISABLE_PIP_VERSION_CHECK=on \
7-
PIP_NO_WARN_SCRIPT_LOCATION=0
7+
PIP_NO_WARN_SCRIPT_LOCATION=0 \
8+
PIP_DEFAULT_TIMEOUT=100 \
9+
POETRY_VERSION=1.7.1
810
ENV TGTG_TOKEN_PATH=/tokens
911
ENV LOGS_PATH=/logs
1012
ENV DOCKER=true
1113
ENV UID=1000
1214
ENV GID=1000
15+
ENV PATH=/venv/bin:${PATH}
1316

14-
RUN addgroup --gid $GID tgtg && \
17+
RUN apt-get update && apt-get upgrade -y
18+
19+
RUN addgroup --gid ${GID} tgtg && \
1520
adduser --shell /bin/false \
1621
--disabled-password \
17-
--uid $UID \
18-
--gid $GID \
22+
--uid ${UID} \
23+
--gid ${GID} \
1924
tgtg
20-
RUN mkdir -p /logs
21-
RUN mkdir -p /tokens
22-
RUN chown tgtg:tgtg /tokens
23-
RUN chown tgtg:tgtg /logs
24-
VOLUME /tokens
25+
RUN mkdir -p ${LOGS_PATH}
26+
RUN mkdir -p ${TGTG_TOKEN_PATH}
27+
RUN chown tgtg:tgtg ${LOGS_PATH}
28+
RUN chown tgtg:tgtg ${TGTG_TOKEN_PATH}
29+
VOLUME ${TGTG_TOKEN_PATH}
30+
31+
FROM base as builder
2532

26-
RUN --mount=type=bind,target=/context \
27-
pip install -r /context/requirements.txt && \
28-
pip install /context
33+
RUN apt-get install -y gcc libffi-dev g++
2934

35+
WORKDIR /build
36+
RUN pip install "poetry==${POETRY_VERSION}" poetry-plugin-bundle
37+
RUN --mount=type=bind,target=. poetry bundle venv /venv
38+
39+
FROM base as final
3040
COPY ./docker/entrypoint.sh /entrypoint.sh
3141
RUN chmod +x /entrypoint.sh
3242

43+
COPY --from=builder /venv /venv
44+
3345
RUN python -m tgtg_scanner -v
3446

3547
ENTRYPOINT [ "/entrypoint.sh" ]

docker/Dockerfile.alpine

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,48 @@
1-
FROM python:3.10-alpine as base
1+
FROM python:3.11-alpine as base
22

33
ENV PYTHONUNBUFFERED=1 \
44
PYTHONDONTWRITEBYTECODE=1 \
55
PIP_NO_CACHE_DIR=off \
66
PIP_DISABLE_PIP_VERSION_CHECK=on \
7-
PIP_NO_WARN_SCRIPT_LOCATION=0
7+
PIP_NO_WARN_SCRIPT_LOCATION=0 \
8+
PIP_DEFAULT_TIMEOUT=100 \
9+
POETRY_VERSION=1.7.1
810
ENV TGTG_TOKEN_PATH=/tokens
911
ENV LOGS_PATH=/logs
1012
ENV DOCKER=true
1113
ENV UID=1000
1214
ENV GID=1000
15+
ENV PATH=/venv/bin:${PATH}
1316

14-
RUN addgroup --gid $GID --system tgtg && \
17+
RUN apk update && apk upgrade && apk add --no-cache shadow runuser
18+
19+
RUN addgroup --gid ${GID} --system tgtg && \
1520
adduser --shell /bin/false \
1621
--disabled-password \
17-
--uid $UID \
22+
--uid ${UID} \
1823
--system \
1924
--ingroup tgtg \
2025
tgtg
21-
RUN mkdir -p /logs
22-
RUN mkdir -p /tokens
23-
RUN chown tgtg:tgtg /tokens
24-
RUN chown tgtg:tgtg /logs
25-
VOLUME /tokens
26+
RUN mkdir -p ${LOGS_PATH}
27+
RUN mkdir -p ${TGTG_TOKEN_PATH}
28+
RUN chown tgtg:tgtg ${LOGS_PATH}
29+
RUN chown tgtg:tgtg ${TGTG_TOKEN_PATH}
30+
VOLUME ${TGTG_TOKEN_PATH}
31+
32+
FROM base as builder
2633

27-
RUN apk update && apk add --no-cache shadow runuser
28-
RUN --mount=type=bind,target=/context \
29-
pip install -r /context/requirements.txt && \
30-
pip install /context
34+
RUN apk add --no-cache gcc libffi-dev g++ musl-dev
3135

36+
WORKDIR /build
37+
RUN pip install "poetry==${POETRY_VERSION}" poetry-plugin-bundle
38+
RUN --mount=type=bind,target=. poetry bundle venv /venv
39+
40+
FROM base as final
3241
COPY ./docker/entrypoint.sh /entrypoint.sh
3342
RUN chmod +x /entrypoint.sh
3443

44+
COPY --from=builder /venv /venv
45+
3546
RUN python -m tgtg_scanner -v
3647

3748
ENTRYPOINT [ "/entrypoint.sh" ]

0 commit comments

Comments
 (0)