diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000..a7f1e44 --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,55 @@ +name: Publish Docker image + +on: + release: + types: [published] + +jobs: + push_to_registry: + name: Push Docker image to Docker Hub + runs-on: ubuntu-latest + env: + REGISTRY: index.docker.io + IMAGE_NAME: obiba/amber + permissions: + id-token: write + contents: read + attestations: write + packages: write + steps: + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.IMAGE_NAME }} + tags: | + type=match,pattern=amber-(\d+.\d+.\d+) + type=match,pattern=amber-(\d+.\d+) + + - name: Build and push Docker image + id: push + uses: docker/build-push-action@v5 + with: + context: . + file: ./Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + + + - name: Generate artifact attestation + uses: actions/attest-build-provenance@v1 + with: + subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + subject-digest: ${{ steps.push.outputs.digest }} + push-to-registry: false + diff --git a/amber/Dockerfile b/Dockerfile similarity index 100% rename from amber/Dockerfile rename to Dockerfile diff --git a/Makefile b/Makefile deleted file mode 100644 index 721533e..0000000 --- a/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -# -# Docker helper -# -tag=1.2 -stag=1.2 -ctag=1.1 -vtag=1.0 -no_cache=false - -help: - @echo sudo make all tag=x.x vtag=y.y - @echo make push-all tag=x.x vtag=y.y - -all: - cd amber && docker build --no-cache=true -t="obiba/amber:$(tag)" . && docker build -t="obiba/amber:latest" . - cd amber-studio && docker build --no-cache=true -t="obiba/amber-studio:$(stag)" . && docker build -t="obiba/amber-studio:latest" . - cd amber-collect && docker build --no-cache=true -t="obiba/amber-collect:$(ctag)" . && docker build -t="obiba/amber-collect:latest" . - cd amber-visit && docker build --no-cache=true -t="obiba/amber-visit:$(vtag)" . && docker build -t="obiba/amber-visit:latest" . - -push-all: - docker image push obiba/amber:$(tag) - docker image push obiba/amber:latest - docker image push obiba/amber-studio:$(stag) - docker image push obiba/amber-studio:latest - docker image push obiba/amber-collect:$(ctag) - docker image push obiba/amber-collect:latest - docker image push obiba/amber-visit:$(vtag) - docker image push obiba/amber-visit:latest - -# Build Docker image -build: - cd $(app) && docker build --no-cache=$(no_cache) -t="obiba/$(app):$(tag)" . - -push: - docker image push obiba/$(app):$(tag) diff --git a/README.md b/README.md index fa613bf..7605503 100644 --- a/README.md +++ b/README.md @@ -13,43 +13,3 @@ Amber server Dockerfile Amber server is a [nodejs](https://nodejs.org/) application. Most of the runtime parameters can be set using [environment variables]((https://github.com/obiba/amber/blob/main/README.md#environment-variables)). For advanced usage, the runtime settings **can** also be amended by copying a local [./config/production.json](https://github.com/obiba/amber/blob/main/config/production.json) file. The `Dockerfile` for a production Amber server will then look like: [Amber Server template](https://github.com/obiba/amber-template/tree/master/amber) - - -Amber Studio app Dockerfile ---------------------------- - -Amber Studio is a [Quasar SPA](https://quasar.dev/quasar-cli-vite/developing-spa/introduction) (single page application) web app delivered by a [NGINX](https://www.nginx.com/) web server. The web app **must** be built with the site specific settings such as the Amber server URL and the [reCAPTCHA](https://developers.google.com/recaptcha/) site key. - -Optionally, some source files can be modified as well: - -* [settings.json](https://github.com/obiba/amber-studio/blob/main/settings.json) file that is a simple way of tweaking the default theme and for adding new languages. -* [public](https://github.com/obiba/amber-studio/tree/main/public) folder that contains the app icons. -* [src/css](https://github.com/obiba/amber-studio/tree/main/src/css) folder that contains the [SCSS](https://sass-lang.com/documentation/syntax) files. - -The `Dockerfile` for a production web server providing the Amber Studio app will then look like: [Amber Studio template](https://github.com/obiba/amber-template/tree/master/amber-studio) - -Amber Collect app Dockerfile ----------------------------- - -Amber Collect is a [Quasar PWA](https://quasar.dev/quasar-cli-vite/developing-pwa/introduction) (progressive web application) web app delivered by a [NGINX](https://www.nginx.com/) web server. The web app **must** be built with the site specific settings such as the Amber server URL and the [reCAPTCHA](https://developers.google.com/recaptcha/) site key. - -Optionally, some source files can be modified as well: - -* [settings.json](https://github.com/obiba/amber-collect/blob/main/settings.json) file that is a simple way of tweaking the default theme and for adding new languages. -* [public](https://github.com/obiba/amber-collect/tree/main/public) folder that contains the app icons. -* [src/css](https://github.com/obiba/amber-collect/tree/main/src/css) folder that contains the [SCSS](https://sass-lang.com/documentation/syntax) files. - -The `Dockerfile` for a production web server providing the Amber Collect app will then look like: [Amber Collect template](https://github.com/obiba/amber-template/tree/master/amber-collect) - -Amber Visit app Dockerfile ----------------------------- - -Amber Collect is a [Quasar SPA](https://quasar.dev/quasar-cli-vite/developing-spa/introduction) (single page application) web app delivered by a [NGINX](https://www.nginx.com/) web server. The web app **must** be built with the site specific settings such as the Amber server URL and the [reCAPTCHA](https://developers.google.com/recaptcha/) site key. - -Optionally, some source files can be modified as well: - -* [settings.json](https://github.com/obiba/amber-visit/blob/main/settings.json) file that is a simple way of tweaking the default theme and for adding new languages. -* [public](https://github.com/obiba/amber-visitt/tree/main/public) folder that contains the app icons. -* [src/css](https://github.com/obiba/amber-visit/tree/main/src/css) folder that contains the [SCSS](https://sass-lang.com/documentation/syntax) files. - -The `Dockerfile` for a production web server providing the Amber Visit app will then look like: [Amber Visit template](https://github.com/obiba/amber-template/tree/master/amber-visit) diff --git a/amber-collect/Dockerfile b/amber-collect/Dockerfile deleted file mode 100644 index c1f7b4f..0000000 --- a/amber-collect/Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -# -# Amber Collect Dockerfile -# - -# release stage -FROM node:20-alpine as release-stage - -ENV AMBER_COLLECT_VERSION 1.1.2 - -WORKDIR /app - -RUN set -x && \ - wget -q -O amber-collect.zip https://github.com/obiba/amber-collect/archive/refs/tags/${AMBER_COLLECT_VERSION}.zip && \ - unzip -q amber-collect.zip && \ - rm amber-collect.zip && \ - mv amber-collect-${AMBER_COLLECT_VERSION}/* . && \ - mv amber-collect-${AMBER_COLLECT_VERSION}/.yarn* . && \ - mv amber-collect-${AMBER_COLLECT_VERSION}/.eslint* amber-collect-${AMBER_COLLECT_VERSION}/.postcssrc.js . && \ - rm -rf amber-collect-${AMBER_COLLECT_VERSION} diff --git a/amber-studio/Dockerfile b/amber-studio/Dockerfile deleted file mode 100644 index e436d5c..0000000 --- a/amber-studio/Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -# -# Amber Studio Dockerfile -# - -# release stage -FROM node:20-alpine as release-stage - -ENV AMBER_STUDIO_VERSION 1.2.2 - -WORKDIR /app - -RUN set -x && \ - wget -q -O amber-studio.zip https://github.com/obiba/amber-studio/archive/refs/tags/${AMBER_STUDIO_VERSION}.zip && \ - unzip -q amber-studio.zip && \ - rm amber-studio.zip && \ - mv amber-studio-${AMBER_STUDIO_VERSION}/* . && \ - mv amber-studio-${AMBER_STUDIO_VERSION}/.yarn* . && \ - mv amber-studio-${AMBER_STUDIO_VERSION}/.eslint* amber-studio-${AMBER_STUDIO_VERSION}/.postcssrc.js . && \ - rm -rf amber-studio-${AMBER_STUDIO_VERSION} diff --git a/amber-visit/Dockerfile b/amber-visit/Dockerfile deleted file mode 100644 index ebe19ec..0000000 --- a/amber-visit/Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -# -# Amber Collect Dockerfile -# - -# release stage -FROM node:20-alpine as release-stage - -ENV AMBER_VISIT_VERSION 1.0.3 - -WORKDIR /app - -RUN set -x && \ - wget -q -O amber-visit.zip https://github.com/obiba/amber-visit/archive/refs/tags/${AMBER_VISIT_VERSION}.zip && \ - unzip -q amber-visit.zip && \ - rm amber-visit.zip && \ - mv amber-visit-${AMBER_VISIT_VERSION}/* . && \ - mv amber-visit-${AMBER_VISIT_VERSION}/.yarn* . && \ - mv amber-visit-${AMBER_VISIT_VERSION}/.eslint* . && \ - rm -rf amber-visit-${AMBER_VISIT_VERSION}