From 3cb02abefac9921633ea90a4d8bf6967ddfee356 Mon Sep 17 00:00:00 2001 From: Adam Hlavacek Date: Sun, 10 Nov 2024 16:44:52 +0100 Subject: [PATCH] feat(docker): auto-publish --- .github/workflows/build-docker.yml | 33 ++++++++++++++++++++++++++++++ package.json | 4 ++-- 2 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/build-docker.yml diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml new file mode 100644 index 00000000..044150b8 --- /dev/null +++ b/.github/workflows/build-docker.yml @@ -0,0 +1,33 @@ +name: Docker Compose Build and Push + +on: + push: + branches: + - main + +jobs: + build_and_push: + runs-on: ubuntu-latest + + steps: + - name: Check out the repository, including submodules + uses: actions/checkout@v3 + with: + submodules: recursive + path: web + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build and push Docker images + working-directory: ./web + run: | + npm install + npm run build.docker + docker compose push diff --git a/package.json b/package.json index 7ec0af00..5e4dbdc5 100644 --- a/package.json +++ b/package.json @@ -6,9 +6,9 @@ "start.pubdev": "ng serve --configuration pubdev", "start.proxy": "ng serve --configuration proxy", "start": "ng serve", - "start.docker": "npm run build.docker && docker-compose up", + "start.docker": "npm run build.docker && docker compose up", "build": "npm run gen.changelog && ng build", - "build.docker": "npm run build && docker-compose build", + "build.docker": "npm run build && docker compose build", "build.pubdev": "npm run gen.changelog && ng build --configuration pubdev", "build.kyzikos": "npm run gen.changelog && ng build --configuration kyzikos && cp -r src/cgi-bin/ dist/web-frontend-angular/cgi-bin/", "build.kleobis": "npm run gen.changelog && ng build --configuration kleobis && cp src/matomo/kleobis.js dist/web-frontend-angular/*/assets/scripts/matomo.js && cp -r src/cgi-bin/ dist/web-frontend-angular/cgi-bin/",