fix(docker): drop RUN commands - quarkus-micro-image:2.0 has no shell
CI / Build Native (push) Failing after 15m1s
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).
This commit is contained in:
@@ -21,10 +21,10 @@ jobs:
|
|||||||
image: maven:3.9.6-eclipse-temurin-21
|
image: maven:3.9.6-eclipse-temurin-21
|
||||||
options: --memory=8g
|
options: --memory=8g
|
||||||
steps:
|
steps:
|
||||||
- name: Install git, node, gcc, docker, and basic tools
|
- name: Install git, node, gcc, docker, buildx, and basic tools
|
||||||
run: |
|
run: |
|
||||||
apt-get update
|
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 -
|
curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
|
||||||
apt-get install -y nodejs
|
apt-get install -y nodejs
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
@@ -32,6 +32,7 @@ jobs:
|
|||||||
node --version
|
node --version
|
||||||
gcc --version
|
gcc --version
|
||||||
docker --version
|
docker --version
|
||||||
|
docker buildx version
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -70,13 +71,15 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
mkdir -p build-output
|
mkdir -p build-output
|
||||||
cp target/shot-crafter-calculator-1.0.0-runner 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
|
- name: Build & Push Docker image
|
||||||
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||||
run: |
|
run: |
|
||||||
set -e
|
set -e
|
||||||
echo "=== Build Docker image ==="
|
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 "=== Login to Gitea Registry ==="
|
||||||
echo "${{ secrets.REGISTRY_TOKEN }}" | docker login gitea.danielarroyo.cl -u "${{ secrets.REGISTRY_USERNAME }}" --password-stdin
|
echo "${{ secrets.REGISTRY_TOKEN }}" | docker login gitea.danielarroyo.cl -u "${{ secrets.REGISTRY_USERNAME }}" --password-stdin
|
||||||
SHORT_SHA=$(echo "$GITHUB_SHA" | cut -c1-7)
|
SHORT_SHA=$(echo "$GITHUB_SHA" | cut -c1-7)
|
||||||
|
|||||||
+1
-6
@@ -9,15 +9,10 @@ RUN microdnf install -y curl-minimal && microdnf clean all \
|
|||||||
&& cp -rP /etc/ssl /out/etc/
|
&& cp -rP /etc/ssl /out/etc/
|
||||||
|
|
||||||
FROM quay.io/quarkus/quarkus-micro-image:2.0
|
FROM quay.io/quarkus/quarkus-micro-image:2.0
|
||||||
SHELL ["/usr/bin/sh", "-c"]
|
|
||||||
WORKDIR /work/
|
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/ /
|
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
|
EXPOSE 8080
|
||||||
USER 1001
|
USER 1001
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user