Commit Graph

9 Commits

Author SHA1 Message Date
darroyo ac349c1b34 fix(docker): drop RUN commands - quarkus-micro-image:2.0 has no shell
CI / Build Native (push) Failing after 15m1s
Removed the RUN chmod/chown/echo steps from the Dockerfile. The Quarkus
micro image 2.0 ships without /bin/sh and /usr/bin/sh, so any RUN
instruction fails. The chmod and securerandom.source append now happen
in the CI 'Stage binary for Docker' step, and COPY --chown=1001:1001
takes ownership of the binary in the image.

COPY --chown requires BuildKit, so:
- Install docker-buildx in the CI
- Switch docker build -> docker buildx build

The final image stays minimal (no shell, no microdnf, no extra packages).
2026-08-13 17:13:54 -04:00
darroyo 11c58aa614 fix(docker): set SHELL to /usr/bin/sh for quarkus-micro-image:2.0
CI / Build Native (push) Failing after 15m24s
The Quarkus micro image 2.0 no longer ships /bin/sh (only /usr/bin/sh).
Docker's default shell is /bin/sh, so RUN commands fail with
'exec /bin/sh: no such file or directory'. Set SHELL explicitly to
/usr/bin/sh to keep the small final image while letting Docker run
RUN commands.
2026-08-13 16:39:04 -04:00
darroyo af92363f18 fix(docker): mkdir /out/etc/pki and /out/etc before cp
CI / Build Native (push) Failing after 8m48s
cp -rP /etc/pki/ca-trust /out/etc/pki/ requires /out/etc/pki to exist.
Consolidated mkdir -p to create both /out/etc/pki and /out/etc.
2026-08-13 16:24:02 -04:00
darroyo 9e81097f53 fix(docker): use install -D to create leading dirs for curl
CI / Build Native (push) Failing after 16m26s
The previous install -m 0755 /usr/bin/curl /out/usr/bin/curl failed because
/out/usr/bin/ did not exist. install -D creates the leading dirs.
2026-08-13 15:45:58 -04:00
darroyo ef8d95b7da fix(docker): use multi-stage build to install curl (quarkus-micro-image:2.0 ships no microdnf)
CI / Build Native (push) Failing after 14m50s
The 2.0 rebuild of quarkus-micro-image removed microdnf to slim the image,
so the inline 'microdnf install curl-minimal' step now fails with
'command not found'.

Build curl-minimal in a ubi9/ubi-minimal builder stage, then copy only the
curl binary + its runtime shared libs + CA bundle into the final
quarkus-micro-image layer. Final image stays slim and the docker-compose
healthcheck keeps working.
2026-08-13 14:59:21 -04:00
darroyo d101d6df0f feat: add HTTP healthcheck endpoint via quarkus-smallrye-health
CI / Build Native (push) Failing after 16m25s
- pom.xml: add quarkus-smallrye-health dependency.
  Exposes /q/health/live and /q/health/ready endpoints (liveness
  and readiness probes for Quarkus apps).
- Dockerfile: install curl-minimal in the microdnf layer so the
  container has a real HTTP client. quarkus-micro-image is based
  on UBI 9 minimal and doesn't ship with curl by default.
- compose.yaml: healthcheck now hits GET /q/health/live with
  curl -f instead of the previous kill -0 1 (which only proved
  the process was alive, not that the HTTP server was responding).

The next CI run will rebuild the native binary with the health
extension baked in; old images pulled from :latest will keep
working since this is additive.
2026-08-13 13:01:20 -04:00
darroyo 9646236fa8 feat: externalize config via env vars
CI / Build Native (push) Successful in 20m1s
- Add .env.example with all configurable variables documented
  (DB URL, HTTP port/host, cookie, JWT issuer/keys, log level)
- Remove hardcoded -Dquarkus.http.host from Dockerfile ENTRYPOINT
  (application.properties already sets the default; env vars
  can now override it at runtime without conflicting with -D flags)

All env vars follow Quarkus's auto-binding convention:
property.key → PROPERTY_KEY (uppercase)

Most useful for production:
- QUARKUS_DATASOURCE_JDBC_URL: DB file path
- QUARKUS_HTTP_PORT: HTTP port
- QUARKUS_HTTP_HOST: bind interface
- APP_AUTH_COOKIE_SECURE: enable Secure flag behind HTTPS
- MP_JWT_VERIFY_PUBLICKEY_LOCATION: externalize RSA keys
2026-08-13 09:27:53 -04:00
darroyo d067110103 fix(ci): stage native binary in build-output/ to bypass .dockerignore
CI / Build Native (push) Failing after 8m52s
The .dockerignore has 'target' which excludes the target/
directory from the docker build context. The Dockerfile was
COPYing the binary from target/, so docker build failed with
'file not found in build context or excluded by .dockerignore'.

Fix: copy the binary to build-output/ (a non-excluded path)
before docker build, and update the Dockerfile to copy from
build-output/.

- Add 'Stage binary for Docker' step that does:
    mkdir -p build-output
    cp target/shot-crafter-calculator-1.0.0-runner build-output/
- Dockerfile COPY now reads build-output/shot-crafter-calculator-1.0.0-runner
- build-output/ is not in .dockerignore -> only the binary
  (~117MB) ships in the build context, not the whole target/
  tree (~200MB with classes, generated-sources, node binaries, etc.)
2026-08-12 19:44:14 -04:00
darroyo 9db3f7a914 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).
2026-08-12 16:16:51 -04:00