Compare commits

..

3 Commits

Author SHA1 Message Date
Julien Calixte
8f3496b07a chore(ci): remove sonarqube and docker build stages 2026-04-22 14:13:41 +02:00
Julien Calixte
f2bd71183f chore(cors): update frontend URL to apoena.dev domain 2026-04-22 14:11:59 +02:00
Julien Calixte
e1aa33fa7b fix(docker): use PORT env var in healthcheck 2026-04-22 14:11:57 +02:00
3 changed files with 2 additions and 78 deletions

View File

@@ -1,12 +1,9 @@
stages: stages:
- validate - validate
- sonar
- test - test
- build
variables: variables:
DENO_VERSION: "2.6.4" DENO_VERSION: "2.6.4"
DOCKER_IMAGE_NAME: "$CI_REGISTRY/deeplite"
PORT: "8000" PORT: "8000"
# Global template for Deno jobs # Global template for Deno jobs
@@ -45,40 +42,6 @@ type:check:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"' - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: "$CI_COMMIT_BRANCH" - if: "$CI_COMMIT_BRANCH"
# ===== SONARQUBE STAGE =====
sonarqube:scan:
stage: sonar
image:
name: sonarsource/sonar-scanner-cli:latest
entrypoint: [""]
variables:
SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar"
GIT_DEPTH: "0"
cache:
key: "${CI_JOB_NAME}"
paths:
- .sonar/cache
script:
- |
sonar-scanner \
-Dsonar.host.url="${SONAR_HOST}" \
-Dsonar.token="${SONAR_TOKEN}" \
-Dsonar.projectKey="${CI_PROJECT_PATH_SLUG}" \
-Dsonar.projectName="${CI_PROJECT_NAME}" \
-Dsonar.projectVersion="${CI_COMMIT_SHORT_SHA}" \
-Dsonar.sources=src \
-Dsonar.sourceEncoding=UTF-8 \
-Dsonar.language=ts \
-Dsonar.exclusions="**/*.test.ts,**/test/**" \
-Dsonar.tests=src \
-Dsonar.test.inclusions="**/*.test.ts"
allow_failure: true
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH"
dependencies: []
# ===== TEST STAGE ===== # ===== TEST STAGE =====
integration:test: integration:test:
@@ -129,42 +92,3 @@ integration:test:
when: when:
- runner_system_failure - runner_system_failure
- stuck_or_timeout_failure - stuck_or_timeout_failure
# ===== BUILD & PUSH STAGE (Tags only) =====
docker:build-push:
stage: build
image: docker:29-dind
services:
- docker:29-dind
variables:
DOCKER_TLS_CERTDIR: "/certs"
before_script:
- docker info
- echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" --password-stdin "$CI_REGISTRY"
script:
- export VERSION=${CI_COMMIT_TAG#v}
- echo "Building and pushing Docker image version $VERSION"
- |
docker build \
--build-arg DENO_VERSION=${DENO_VERSION} \
--tag ${DOCKER_IMAGE_NAME}:${VERSION} \
--tag ${DOCKER_IMAGE_NAME}:${CI_COMMIT_SHA} \
--tag ${DOCKER_IMAGE_NAME}:latest \
.
- docker push ${DOCKER_IMAGE_NAME}:${VERSION}
- docker push ${DOCKER_IMAGE_NAME}:${CI_COMMIT_SHA}
- docker push ${DOCKER_IMAGE_NAME}:latest
- echo "Successfully pushed:"
- echo " - ${DOCKER_IMAGE_NAME}:${VERSION}"
- echo " - ${DOCKER_IMAGE_NAME}:${CI_COMMIT_SHA}"
- echo " - ${DOCKER_IMAGE_NAME}:latest"
rules:
- if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+$/'
retry:
max: 2
when:
- runner_system_failure

View File

@@ -26,7 +26,7 @@ USER denouser
# Health check # Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD deno eval "fetch('http://localhost:8000/health').then(r => r.ok ? Deno.exit(0) : Deno.exit(1))" || exit 1 CMD deno eval "fetch('http://localhost:' + (Deno.env.get('PORT') || '8000') + '/health').then(r => r.ok ? Deno.exit(0) : Deno.exit(1))" || exit 1
# Run the application # Run the application
CMD ["deno", "run", "--allow-net", "--allow-env", "src/main.ts"] CMD ["deno", "run", "--allow-net", "--allow-env", "src/main.ts"]

View File

@@ -5,7 +5,7 @@ const DEEPL_API_KEY = Deno.env.get("DEEPL_AUTH_KEY");
const BEARER_TOKEN = Deno.env.get("BEARER_TOKEN"); const BEARER_TOKEN = Deno.env.get("BEARER_TOKEN");
const PORT = parseInt(Deno.env.get("PORT") || "8000"); const PORT = parseInt(Deno.env.get("PORT") || "8000");
const DEEPL_API_BASE = "https://api-free.deepl.com/v2"; const DEEPL_API_BASE = "https://api-free.deepl.com/v2";
const FRONTEND_URLS = ["http://localhost", "https://deep-lite.netlify.app"]; const FRONTEND_URLS = ["http://localhost", "https://deeplite.apoena.dev"];
if (!DEEPL_API_KEY) { if (!DEEPL_API_KEY) {
console.error("ERROR: DEEPL_AUTH_KEY environment variable is required"); console.error("ERROR: DEEPL_AUTH_KEY environment variable is required");