mirror of
https://github.com/nikdoof/smsbot.git
synced 2025-12-14 10:32:16 +00:00
Use '.python-version' for builds
This commit is contained in:
6
.github/workflows/build-container.yaml
vendored
6
.github/workflows/build-container.yaml
vendored
@@ -22,11 +22,17 @@ jobs:
|
|||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- name: Set build args
|
||||||
|
run: |
|
||||||
|
PYTHON_VERSION=$(cat .python-version)
|
||||||
|
echo "PYTHON_VERSION=$PYTHON_VERSION" >> $GITHUB_ENV
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
id: docker_build
|
id: docker_build
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
push: true
|
push: true
|
||||||
|
build-args: |
|
||||||
|
PYTHON_VERSION=${{ env.PYTHON_VERSION }}
|
||||||
tags: |
|
tags: |
|
||||||
ghcr.io/${{ github.repository }}:${{ github.ref_name }}
|
ghcr.io/${{ github.repository }}:${{ github.ref_name }}
|
||||||
ghcr.io/${{ github.repository }}:latest
|
ghcr.io/${{ github.repository }}:latest
|
||||||
|
|||||||
2
.github/workflows/release.yaml
vendored
2
.github/workflows/release.yaml
vendored
@@ -14,8 +14,6 @@ jobs:
|
|||||||
|
|
||||||
- name: Setup Python
|
- name: Setup Python
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v5
|
||||||
with:
|
|
||||||
python-version: "3.9"
|
|
||||||
|
|
||||||
- name: Install uv
|
- name: Install uv
|
||||||
uses: astral-sh/setup-uv@v6
|
uses: astral-sh/setup-uv@v6
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim AS builder
|
ARG PYTHON_VERSION="3.13"
|
||||||
|
|
||||||
|
FROM ghcr.io/astral-sh/uv:python${PYTHON_VERSION}-bookworm-slim AS builder
|
||||||
ENV UV_COMPILE_BYTECODE=1 UV_LINK_MODE=copy
|
ENV UV_COMPILE_BYTECODE=1 UV_LINK_MODE=copy
|
||||||
ENV UV_PYTHON_DOWNLOADS=0
|
ENV UV_PYTHON_DOWNLOADS=0
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
@@ -11,7 +13,7 @@ RUN --mount=type=cache,target=/root/.cache/uv \
|
|||||||
uv sync --locked --no-dev
|
uv sync --locked --no-dev
|
||||||
|
|
||||||
|
|
||||||
FROM python:3.13-slim-bookworm
|
FROM python:${PYTHON_VERSION}-slim-bookworm
|
||||||
COPY --from=builder --chown=app:app /app /app
|
COPY --from=builder --chown=app:app /app /app
|
||||||
ENV PATH="/app/.venv/bin:$PATH"
|
ENV PATH="/app/.venv/bin:$PATH"
|
||||||
EXPOSE 80/tcp
|
EXPOSE 80/tcp
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ tasks:
|
|||||||
docker:build:
|
docker:build:
|
||||||
desc: Build the container using Docker
|
desc: Build the container using Docker
|
||||||
cmds:
|
cmds:
|
||||||
- docker build . -t smsbot:latest
|
- docker build . --build-arg PYTHON_VERSION=$(cat .python-version) -t smsbot:latest
|
||||||
|
|
||||||
smsbot:run:
|
smsbot:run:
|
||||||
desc: Run the SMSBot
|
desc: Run the SMSBot
|
||||||
|
|||||||
Reference in New Issue
Block a user