Skip to content

Commit

Permalink
test with different docker action
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaconsalvi committed Aug 19, 2024
1 parent 73c1b25 commit b6dc6d4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 43 deletions.
51 changes: 13 additions & 38 deletions .github/workflows/build-n-push-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,47 +30,22 @@ jobs:
token: ${{ secrets.GIT_PAT }}
fetch-depth: 0

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: network=host

- name: Build and pushx
uses: docker/build-push-action@v6
with:
push: true
file: src/main/docker/Dockerfile.multistage
tags: ghcr.io/${{ github.repository }}:${{ github.head_ref || github.ref_name }}
secrets: |
"git_user=${{ secrets.GIT_USER }}"
"git_pass=${{ secrets.GIT_PAT }}"
#
# Install Node.
# RELEASE CANDIDATE - Build Docker image.
#
- name: Install Node
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c
with:
node-version: "18.16.0"

#
# Install Newman.
#
- name: Install Newman
run: npm install -g newman
- name: RELEASE CANDIDATE - Build Docker image
run: |
docker build \
--secret id=git_user,env=${{ secrets.GIT_USER }}
--secret id=git_pass,env=${{ secrets.GIT_PAT }}
-f src/main/docker/Dockerfile.multistage \
-t ghcr.io/${{ github.repository }}:${{ github.head_ref || github.ref_name }} \
.
#
# Run Postman collection.
# RELEASE CANDIDATE - Push Docker image.
#
- name: Run Postman collection
- name: RELEASE CANDIDATE - Push Docker image
run: |
newman run src/test/postman/mil-papos.postman_collection.json \
-e src/test/postman/dev.postman_environment.json \
--env-var "clientIdPsp=${{ secrets.NEWMAN_IT__PSP_TOKEN_CLIENT_ID }}" \
--env-var "clientSecretPsp=${{ secrets.NEWMAN_IT_PSP_TOKEN_CLIENT_SECRET }}" \
--env-var "clientIdPa=${{ secrets.NEWMAN_IT__PA_TOKEN_CLIENT_ID }}" \
--env-var "clientSecretPa=${{ secrets.NEWMAN_IT_PA_TOKEN_CLIENT_SECRET }}" \
--env-var "clientIdAdm=${{ secrets.NEWMAN_IT__PAPOS_ADMIN_TOKEN_CLIENT_ID }}" \
--env-var "clientSecretAdm=${{ secrets.NEWMAN_IT_PAPOS_ADMIN_TOKEN_CLIENT_SECRET }}"
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
docker push -a ghcr.io/${{ github.repository }}
8 changes: 3 additions & 5 deletions src/main/docker/Dockerfile.multistage
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ COPY --chown=quarkus:quarkus .mvn/ /code/.mvn
COPY --chown=quarkus:quarkus pom.xml /code/
USER quarkus
WORKDIR /code
RUN --mount=type=secret,id=git_pass \
export GIT_USER=$(cat /run/secrets/git_user)
RUN --mount=type=secret,id=git_user \
--mount=type=secret,id=git_pass \
export GIT_USER=$(cat /run/secrets/git_user) && \
export GIT_PASS=$(cat /run/secrets/git_pass) && \
yarn gen

export GIT_PASS=$(cat /run/secrets/git_pass)
RUN echo "<settings><servers><server><id>github</id><username>$env:GIT_USERNAME</username><password>$env:GIT_PASSWORD</password></server></servers></settings>" >> /root/.m2/settings.xml
RUN ./mvnw -B org.apache.maven.plugins:maven-dependency-plugin:3.7.1:go-offline
COPY src /code/src
Expand Down

0 comments on commit b6dc6d4

Please sign in to comment.