diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 68d2704..9dab68f 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -21,10 +21,10 @@ jobs: image: maven:3.9.6-eclipse-temurin-21 options: --memory=8g steps: - - name: Install git, node, gcc, docker, and basic tools + - name: Install git, node, gcc, docker, buildx, and basic tools run: | apt-get update - apt-get install -y git curl ca-certificates build-essential zlib1g-dev docker.io + apt-get install -y git curl ca-certificates build-essential zlib1g-dev docker.io docker-buildx curl -fsSL https://deb.nodesource.com/setup_22.x | bash - apt-get install -y nodejs rm -rf /var/lib/apt/lists/* @@ -32,6 +32,7 @@ jobs: node --version gcc --version docker --version + docker buildx version - name: Checkout uses: actions/checkout@v4 @@ -70,13 +71,15 @@ jobs: run: | mkdir -p build-output cp target/shot-crafter-calculator-1.0.0-runner build-output/ + chmod 775 build-output/shot-crafter-calculator-1.0.0-runner + echo "securerandom.source=file:/dev/urandom" >> build-output/shot-crafter-calculator-1.0.0-runner - name: Build & Push Docker image if: github.event_name == 'push' && github.ref == 'refs/heads/main' run: | set -e echo "=== Build Docker image ===" - docker build -t shot-crafter-calculator:ci . + docker buildx build -t shot-crafter-calculator:ci . echo "=== Login to Gitea Registry ===" echo "${{ secrets.REGISTRY_TOKEN }}" | docker login gitea.danielarroyo.cl -u "${{ secrets.REGISTRY_USERNAME }}" --password-stdin SHORT_SHA=$(echo "$GITHUB_SHA" | cut -c1-7) diff --git a/Dockerfile b/Dockerfile index f30bffb..5c77757 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,15 +9,10 @@ RUN microdnf install -y curl-minimal && microdnf clean all \ && cp -rP /etc/ssl /out/etc/ FROM quay.io/quarkus/quarkus-micro-image:2.0 -SHELL ["/usr/bin/sh", "-c"] WORKDIR /work/ -COPY build-output/shot-crafter-calculator-1.0.0-runner /work/application +COPY --chown=1001:1001 build-output/shot-crafter-calculator-1.0.0-runner /work/application COPY --from=curl-builder /out/ / -RUN chmod 775 /work /work/application \ - && chown -R 1001 /work \ - && echo "securerandom.source=file:/dev/urandom" >> /work/application - EXPOSE 8080 USER 1001