diff --git a/.github/workflows/buildImage.yaml b/.github/workflows/buildImage.yaml index 26981e0..613f0ae 100644 --- a/.github/workflows/buildImage.yaml +++ b/.github/workflows/buildImage.yaml @@ -6,6 +6,10 @@ on: branches: - main +env: + REGISTRY: docker.io + IMAGE_NAME: ${{ github.repository }} + jobs: build: runs-on: ubuntu-latest @@ -14,6 +18,12 @@ jobs: steps: - name: Checkout Repository uses: actions/checkout@v4 + + - name: Build image + run: docker-compose build --no-cache --force-rm + + - name: Test image + run: docker-compose up -d - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -24,10 +34,16 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Extract metadata + id: meta + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + - name: Build and push - uses: docker/build-push-action@v5 + uses: docker/build-push-action@v2 with: - context: . - file: ./docker-compose.yml + context: "{{defaultContext}}" push: true - tags: ${{ secrets.DOCKERHUB_USERNAME }}/contentsharingplatform:latest \ No newline at end of file + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file