From e7487690120ba839804e69cab2eeb1d7d996d2d0 Mon Sep 17 00:00:00 2001 From: Cizz22 Date: Thu, 19 Feb 2026 12:29:26 +0700 Subject: [PATCH] feat: Update Gitea authentication to use username and password instead of a token and downgrade Python base image to 3.11. --- Dockerfile | 12 ++++++------ Jenkinsfile | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index f189cc7..2bccea8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,11 @@ # Use the official Python 3.11 image from the Docker Hub -FROM python:3.13-slim as builder - -ARG GITEA_TOKEN +FROM python:3.11-slim as builder # Install Poetry RUN pip install poetry - -RUN poetry config http-basic.licaeros-repo token ${GITEA_TOKEN} +ARG GITEA_USERNAME +ARG GITEA_PASSWORD # Set environment variables for Poetry ENV POETRY_NO_INTERACTION=1 \ @@ -18,6 +16,8 @@ ENV POETRY_NO_INTERACTION=1 \ # Set the working directory WORKDIR /app +RUN poetry config http-basic.licaeros-repo ${GITEA_USERNAME} ${GITEA_PASSWORD} + # Copy the Poetry configuration files COPY pyproject.toml poetry.lock ./ @@ -25,7 +25,7 @@ COPY pyproject.toml poetry.lock ./ RUN poetry install --no-root # Use a new slim image for the runtime -FROM python:3.13-slim as runtime +FROM python:3.11-slim as runtime # Install necessary tools for running the app, including `make` RUN apt-get update && apt-get install -y --no-install-recommends \ diff --git a/Jenkinsfile b/Jenkinsfile index 6bed528..640a011 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,7 +5,7 @@ pipeline { DOCKER_HUB_USERNAME = 'aimodocker' // This creates DOCKER_AUTH_USR and DOCKER_AUTH_PSW DOCKER_AUTH = credentials('aimodocker') - GITEA_ID = 'gitea-token-secret' + GITEA_CREDS = credentials('gitea-credentials') IMAGE_NAME = 'rbd-service' SERVICE_NAME = 'ahm-app' @@ -53,12 +53,12 @@ pipeline { stage('Build & Tag') { steps { - withCredentials([string(credentialsId: GITEA_ID, variable: 'GITEA_TOKEN')]) { + withCredentials([usernamePassword(credentialsId: 'gitea-credentials', usernameVariable: 'GITEA_USERNAME', passwordVariable: 'GITEA_PASSWORD')]) { // Logic and variable definitions go inside 'script' script { def fullImageName = "${DOCKER_HUB_USERNAME}/${IMAGE_NAME}" - sh "docker build --build-arg GITEA_TOKEN=${GITEA_TOKEN} -t ${fullImageName}:${IMAGE_TAG} ." + sh "docker build --build-arg GITEA_USERNAME=${GITEA_USERNAME} --build-arg GITEA_PASSWORD=${GITEA_PASSWORD} -t ${fullImageName}:${IMAGE_TAG} ." if (SECONDARY_TAG) { sh "docker tag ${fullImageName}:${IMAGE_TAG} ${fullImageName}:${SECONDARY_TAG}"