ci: build native Docker image and push to Gitea Container Registry
CI / Build Native (push) Failing after 2s
CI / Build JVM (push) Failing after 7s
CI / Build & Push Native Image (push) Has been skipped

Adds:
- Dockerfile based on quarkus-micro-image:2.0 (~50MB base)
  Runs the native binary as non-root user 1001, exposes 8080
- .dockerignore to exclude build artifacts
- Gitea Actions workflow with 3 parallel jobs:
  - build-jvm: standard JAR (mvn package)
  - build-native: GraalVM native binary (mvn package -Pnative)
  - docker-native: takes the native binary artifact, builds
    the container image and pushes to
    gitea.danielarroyo.cl/proyectos/shot-crafter-calculator
    with tags 'latest' and short SHA

Triggers: push to main and PRs (docker job only on push).
Required secrets: GITEA_USERNAME, GITEA_TOKEN (write:packages).
This commit is contained in:
2026-08-12 16:16:51 -04:00
parent 47e24df40d
commit 9db3f7a914
3 changed files with 143 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
.git
target
node_modules
data
.mvn
*.md
.gitignore
.gitea
+123
View File
@@ -0,0 +1,123 @@
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
build-jvm:
name: Build JVM
runs-on: ubuntu-latest
container:
image: docker.io/quarkusio/quarkus-images:tooling-21
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache Maven
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
- name: Cache Node + npm
uses: actions/cache@v4
with:
path: |
target/node
src/frontend/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('src/frontend/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-
- name: Build (JVM)
run: mvn package -B -DskipTests
- name: Upload JVM artifact
uses: actions/upload-artifact@v4
with:
name: shot-crafter-calculator-jvm
path: target/quarkus-app/
build-native:
name: Build Native
runs-on: ubuntu-latest
container:
image: docker.io/quarkusio/quarkus-images:tooling-21
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache Maven
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
- name: Cache Node + npm
uses: actions/cache@v4
with:
path: |
target/node
src/frontend/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('src/frontend/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-
- name: Build (Native)
run: mvn package -Pnative -B -DskipTests
- name: Upload Native binary
uses: actions/upload-artifact@v4
with:
name: shot-crafter-calculator-runner
path: target/shot-crafter-calculator-1.0.0-runner
docker-native:
name: Build & Push Native Image
runs-on: ubuntu-latest
needs: build-native
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download native binary
uses: actions/download-artifact@v4
with:
name: shot-crafter-calculator-runner
path: target/
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Gitea Container Registry
uses: docker/login-action@v3
with:
registry: gitea.danielarroyo.cl
username: ${{ secrets.GITEA_USERNAME }}
password: ${{ secrets.GITEA_TOKEN }}
- name: Extract short SHA
id: meta
run: echo "short_sha=${GITHUB_SHA::7}" >> $GITHUB_OUTPUT
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
push: true
tags: |
gitea.danielarroyo.cl/proyectos/shot-crafter-calculator:latest
gitea.danielarroyo.cl/proyectos/shot-crafter-calculator:${{ steps.meta.outputs.short_sha }}
platforms: linux/amd64
+12
View File
@@ -0,0 +1,12 @@
FROM quay.io/quarkus/quarkus-micro-image:2.0
WORKDIR /work/
COPY target/shot-crafter-calculator-1.0.0-runner /work/application
RUN chmod 775 /work /work/application \
&& chown -R 1001 /work \
&& echo "securerandom.source=file:/dev/urandom" >> /work/application
EXPOSE 8080
USER 1001
ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"]