Skip to content

Commit

Permalink
Dockerfile for prod or dev check
Browse files Browse the repository at this point in the history
  • Loading branch information
TimofeyTst committed Oct 8, 2023
1 parent c3ddf72 commit 57f3c49
Showing 1 changed file with 31 additions and 32 deletions.
63 changes: 31 additions & 32 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
# - 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:
Expand Down

0 comments on commit 57f3c49

Please sign in to comment.