Skip to content

Commit

Permalink
Add OCI image build step to CI pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
clementguillot committed Feb 22, 2024
1 parent 96aefa6 commit a0a98e8
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 14 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/ci.yml → .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,30 @@ jobs:
- uses: ./.github/actions/nx-affected-target
with:
target: build
build-oci-images:
runs-on: ubuntu-latest
needs: [build]
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: ./.github/actions/nx-affected-target
with:
target: container
env:
INPUT_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
INPUT_PUSH: true
test:
runs-on: ubuntu-latest
steps:
Expand Down
6 changes: 3 additions & 3 deletions apps/api/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@
"engine": "docker",
"context": "apps/api",
"file": "apps/api/src/main/docker/Dockerfile.mandrel",
"load": true,
"metadata": {
"images": ["[ghcr.io/clementguillot/nx-cloud-ce-api"],
"images": ["ghcr.io/clementguillot/nx-cloud-ce-api"],
"tags": [
"type=schedule",
"type=sha,prefix="
"type=sha,prefix=",
"latest"
]
}
}
Expand Down
23 changes: 12 additions & 11 deletions apps/api/src/main/docker/Dockerfile.mandrel
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@ FROM quay.io/quarkus/ubi-quarkus-mandrel-builder-image:jdk-21 AS build
COPY --chown=quarkus:quarkus build/native-sources /code/native-sources
USER quarkus
WORKDIR /code/native-sources
RUN native-image $(cat native-image.args)
#RUN native-image $(cat native-image.args)
RUN echo $(cat native-image.args)

FROM quay.io/quarkus/quarkus-micro-image:2.0

WORKDIR /work/
RUN chown 1001 /work \
&& chmod "g+rwX" /work \
&& chown 1001:root /work
COPY --from=build --chown=1001:root /code/native-sources/*-runner /work/application

EXPOSE 8080
USER 1001
#FROM quay.io/quarkus/quarkus-micro-image:2.0
#
#WORKDIR /work/
#RUN chown 1001 /work \
# && chmod "g+rwX" /work \
# && chown 1001:root /work
#COPY --from=build --chown=1001:root /code/native-sources/*-runner /work/application
#
#EXPOSE 8080
#USER 1001

ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"]

0 comments on commit a0a98e8

Please sign in to comment.