Skip to content

Commit

Permalink
Merge pull request #111 from OpenConext/feature/docker_add_version_info
Browse files Browse the repository at this point in the history
Feature/docker add version info
  • Loading branch information
quartje authored Mar 4, 2024
2 parents 02f8f31 + e758454 commit 888a743
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 21 deletions.
41 changes: 31 additions & 10 deletions .github/workflows/build-push-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,57 @@ jobs:
packages: write
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Get the latest release
id: release
uses: robinraju/release-downloader@v1.7
uses: robinraju/release-downloader@v1.9
with:
latest: true
fileName: "*.tar.bz2"

- name: Get commit details for the tag from the latest release
id: commit_details
run: |
GIT_SHA=$(git rev-list -n 1 ${{ steps.release.outputs.tag_name }})
GIT_COMMIT_TIME=$(git show -s --format=%ci ${{ steps.release.outputs.tag_name }})
echo "::set-output name=sha::$GIT_SHA"
echo "::set-output name=commit_time::$GIT_COMMIT_TIME"
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set docker labels and tags
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/openconext/stepup-azuremfa/stepup-azuremfa
tags: |
type=ref,event=tag
type=semver,pattern={{version}}
type=sha
type=raw,value=prod
- name: Build and push the Production image
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
build-args: |
APP_VERSION=${{ steps.release.outputs.tag_name }}
GIT_SHA=${{ steps.commit_details.outputs.sha }}
GIT_COMMIT_TIME=${{ steps.commit_details.outputs.commit_time }}
file: docker/Dockerfile.prod
platforms: linux/amd64,linux/arm64
push: true
tags: |
ghcr.io/openconext/stepup-azuremfa/stepup-azuremfa:prod
ghcr.io/openconext/stepup-azuremfa/stepup-azuremfa:${{ github.sha }}
ghcr.io/openconext/stepup-azuremfa/stepup-azuremfa:${{ steps.release.outputs.tag_name }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"ext-openssl": "*",
"ext-zlib": "*",
"incenteev/composer-parameter-handler": "^2.1",
"openconext/monitor-bundle": "^4.0",
"openconext/monitor-bundle": "^4.1",
"surfnet/stepup-bundle": "^6.0",
"surfnet/stepup-gssp-bundle": "^5.0",
"surfnet/stepup-saml-bundle": "^6.0",
Expand Down Expand Up @@ -80,7 +80,6 @@
"@phpstan",
"@unit-tests"
],

"behat": "./ci/qa/behat",
"composer-validate": "./ci/qa/validate",
"docheader": "./ci/qa/docheader",
Expand Down
18 changes: 9 additions & 9 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions docker/Dockerfile.prod
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
FROM ghcr.io/openconext/openconext-basecontainers/php82-apache2:latest
ARG APP_VERSION
ARG GIT_SHA
ARG GIT_COMMIT_TIME
ENV OPENCONEXT_APP_VERSION=${APP_VERSION}
ENV OPENCONEXT_GIT_SHA=${GIT_SHA}
ENV OPENCONEXT_COMMIT_DATE=${GIT_COMMIT_TIME}

COPY *.tar.bz2 /tmp/
RUN tar -xvjf /tmp/*.tar.bz2 -C /var/www/html/ && \
rm -rf /tmp/*.tar.bz2
Expand Down

0 comments on commit 888a743

Please sign in to comment.