From 57f3c49651537808456520c278edebc0343debb4 Mon Sep 17 00:00:00 2001 From: TimofeyTst Date: Sun, 8 Oct 2023 12:49:59 +0300 Subject: [PATCH] Dockerfile for prod or dev check --- .github/workflows/main.yml | 63 +++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 32 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6fc7011..fc22747 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,41 +8,40 @@ on: jobs: build: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Docker meta - id: meta - uses: docker/metadata-action@v5 - with: - # list of Docker images to use as base name for tags - images: timofeytst/eat-place + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ secrets.DOCKERHUB_USERNAME }}/eat-place - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - # - name: Get branch name - # uses: nelonoel/branch-name@v1.0.1 - # - run: echo ${BRANCH_NAME} + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 - - name: Build and push - uses: docker/build-push-action@v5 - with: - push: true - file: Dockerfile.prod - # tags: timofeytst/eat-place:${BRANCH_NAME} - tags: ${{ steps.meta.outputs.tags }} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v5 + with: + push: true + file: | + if [ "$GITHUB_REF" == "refs/heads/prod" ]; then + echo "Dockerfile.prod" + else + echo "Dockerfile" + fi + tags: ${{ steps.meta.outputs.tags }} deploy: