fix(ci): stage native binary in build-output/ to bypass .dockerignore
CI / Build Native (push) Failing after 8m52s
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.)
This commit is contained in:
@@ -66,6 +66,11 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
ls -la target/shot-crafter-calculator-1.0.0-runner
|
ls -la target/shot-crafter-calculator-1.0.0-runner
|
||||||
|
|
||||||
|
- name: Stage binary for Docker
|
||||||
|
run: |
|
||||||
|
mkdir -p build-output
|
||||||
|
cp target/shot-crafter-calculator-1.0.0-runner build-output/
|
||||||
|
|
||||||
- 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: |
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
FROM quay.io/quarkus/quarkus-micro-image:2.0
|
FROM quay.io/quarkus/quarkus-micro-image:2.0
|
||||||
WORKDIR /work/
|
WORKDIR /work/
|
||||||
COPY target/shot-crafter-calculator-1.0.0-runner /work/application
|
COPY build-output/shot-crafter-calculator-1.0.0-runner /work/application
|
||||||
|
|
||||||
RUN chmod 775 /work /work/application \
|
RUN chmod 775 /work /work/application \
|
||||||
&& chown -R 1001 /work \
|
&& chown -R 1001 /work \
|
||||||
|
|||||||
Reference in New Issue
Block a user