Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .github/workflows/docker_build_stg_images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,20 @@ jobs:
with:
images: os2display/display-api-service

- name: Set release timestamp
run: |
echo "APP_RELEASE_TIMESTAMP=$(echo $(date +%s))" >> $GITHUB_ENV
echo "APP_RELEASE_TIME=$(echo $(date))" >> $GITHUB_ENV

- name: Build and push (API)
uses: docker/build-push-action@v6
with:
context: ./infrastructure/display-api-service/
file: ./infrastructure/display-api-service/Dockerfile
build-args: |
VERSION=${{ env.APP_VERSION }}
APP_VERSION=${{ env.APP_VERSION }}
APP_RELEASE_TIMESTAMP=${{ env.APP_RELEASE_TIMESTAMP }}
APP_RELEASE_TIME=${{ env.APP_RELEASE_TIME }}
push: true
tags: ${{ steps.meta-api.outputs.tags }}
labels: ${{ steps.meta-api.outputs.labels }}
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/github_build_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ jobs:
docker compose run --rm node npm install
docker compose run --rm node npm run build

- name: Set release timestamp
run: |
echo "APP_RELEASE_TIMESTAMP=$(echo $(date +%s))" >> $GITHUB_ENV
echo "APP_RELEASE_TIME=$(echo $(date))" >> $GITHUB_ENV

- name: Create release file
run: |
printf "{\n \"releaseTimestamp\": ${{ env.APP_RELEASE_TIMESTAMP }},\n \"releaseTime\": \"${{ env.APP_RELEASE_TIME }}\",\n \"releaseVersion\": \"${{ github.ref_name }}\"\n}" > public/release.json
cat public/release.json

- name: Cleanup after install
run: |
sudo chown -R runner:runner .
Expand Down Expand Up @@ -102,6 +112,11 @@ jobs:
tags: |
type=raw,value=${{ github.ref_name }}

- name: Set release timestamp
run: |
echo "APP_RELEASE_TIMESTAMP=$(echo $(date +%s))" >> $GITHUB_ENV
echo "APP_RELEASE_TIME=$(echo $(date))" >> $GITHUB_ENV

- name: Build and push Docker image (main)
id: push-main
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
Expand All @@ -110,6 +125,8 @@ jobs:
file: ./infrastructure/display-api-service/Dockerfile
build-args: |
APP_VERSION=${{ github.ref_name }}
APP_RELEASE_TIMESTAMP=${{ env.APP_RELEASE_TIMESTAMP }}
APP_RELEASE_TIME=${{ env.APP_RELEASE_TIME }}
push: true
tags: ${{ steps.meta-main.outputs.tags }}
labels: ${{ steps.meta-main.outputs.labels }}
Expand All @@ -132,6 +149,8 @@ jobs:
file: ./infrastructure/nginx/Dockerfile
build-args: |
APP_VERSION=${{ github.ref_name }}
APP_RELEASE_TIMESTAMP=${{ env.APP_RELEASE_TIMESTAMP }}
APP_RELEASE_TIME=${{ env.APP_RELEASE_TIME }}
APP_IMAGE=${{ env.IMAGE_NAME_MAIN }}
push: true
pull: true
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ All notable changes to this project will be documented in this file.
- Added relations checksum feature flag.
- Fixes saving issues described in issue where saving resulted in infinite spinner.
- Fixed loading of routes containing null string values.
- Fixed release.json creation in v3.

### NB! Prior to 3.x the project was split into separate repositories

Expand Down
2 changes: 2 additions & 0 deletions infrastructure/build-n-push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ docker buildx build \
--no-cache \
--pull \
--build-arg APP_VERSION=${APP_VERSION} \
--build-arg APP_RELEASE_TIME="$(date)" \
--build-arg APP_RELEASE_TIMESTAMP="$(date +%s)" \
--tag=ghcr.io/itk-dev/os2display-api-service:${APP_VERSION} \
--file="display-api-service/Dockerfile" ../

Expand Down
5 changes: 5 additions & 0 deletions infrastructure/display-api-service/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ FROM --platform=$BUILDPLATFORM itkdev/php8.4-fpm:latest AS api_app_builder
LABEL maintainer="ITK Dev <itkdev@mkb.aarhus.dk>"

ARG APP_VERSION="develop"
ARG APP_RELEASE_TIMESTAMP=0
ARG APP_RELEASE_TIME=""
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we do default values similar to

      --build-arg APP_RELEASE_TIME="$(date)" \
      --build-arg APP_RELEASE_TIMESTAMP="$(date +%s)" \

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea


WORKDIR /app

Expand All @@ -40,6 +42,9 @@ RUN APP_ENV=prod composer install --no-dev --optimize-autoloader --classmap-auth

COPY --chown=deploy:deploy --from=assets_builder /app/public/build /app/public/build

# Create release.json file in public folder
RUN echo "{\"releaseTimestamp\": $APP_RELEASE_TIMESTAMP, \"releaseTime\": \"$APP_RELEASE_TIME\", \"releaseVersion\": \"$APP_VERSION\"}" > public/release.json

# Remove files we do not need to the final image
RUN rm -rf package* vite.config.js

Expand Down
Loading