diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml new file mode 100644 index 000000000..3df58d7de --- /dev/null +++ b/.github/workflows/build-docker.yml @@ -0,0 +1,51 @@ +name: Build docker images + +on: + push: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + strategy: + matrix: + package: + - default + - cdn + - api + - gateway + - admin-api + - cdn-cs + - gateway-offload + steps: + - uses: actions/checkout@v6 + - uses: cachix/install-nix-action@v31 + with: + nix_path: nixpkgs=channel:nixos-unstable + - name: Build the docker image + run: nix build .#containers.x86_64-linux.docker.${{ matrix.package }} + - run: docker load < result + - name: downcase REPO + run: echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV} + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Compute image suffix + run: | + if [ "${{ matrix.package }}" = "default" ]; then + echo "SUFFIX=" >> $GITHUB_ENV + else + echo "SUFFIX=-${{ matrix.package }}" >> $GITHUB_ENV + fi + - name: Tag and push the image + run: | + IMAGE_ID=$(docker images spacebar-server-ts$SUFFIX --format '{{.ID}}') + docker tag $IMAGE_ID ghcr.io/$REPO$SUFFIX:latest + docker push ghcr.io/$REPO$SUFFIX:latest diff --git a/.github/workflows/publish-image.yml b/.github/workflows/publish-image.yml deleted file mode 100644 index ed1ff7349..000000000 --- a/.github/workflows/publish-image.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: Publish Image - -on: - release: - types: [published] - -env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} - -jobs: - build-and-push-image: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - attestations: write - id-token: write - steps: - - name: Checkout repository - uses: actions/checkout@v5 - - - name: Log in to the Container registry - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - - name: Build and push Docker image - id: push - uses: docker/build-push-action@v6 - with: - context: . - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - - - name: Generate artifact attestation - uses: actions/attest-build-provenance@v3 - with: - subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} - subject-digest: ${{ steps.push.outputs.digest }} - push-to-registry: true diff --git a/.idea/runConfigurations/Start_API.xml b/.idea/runConfigurations/Start_API.xml index 83d9203ae..e0af9ce60 100644 --- a/.idea/runConfigurations/Start_API.xml +++ b/.idea/runConfigurations/Start_API.xml @@ -12,12 +12,15 @@