Skip to content

⚡fixed docker build #11

⚡fixed docker build

⚡fixed docker build #11

Workflow file for this run

name: Build and publish a Docker image
on:
push:
branches:
- '*'
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
pull_request:
branches:
- '*'
jobs:
build:
name: Build & push docker image
runs-on: ubuntu-latest
env:
IMG_NAME_CLIENT: "theanuragshukla/omegle"
IMG_NAME_SERVER: "theanuragshukla/omeserver"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Debug
run: |
echo "github.ref -> {{ github.ref }}"
- name: Client metadata
id: metadata_client
uses: docker/metadata-action@v3
with:
images: ${{ env.IMG_NAME_CLIENT }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value={{sha}},enable=${{ github.ref_type != 'tag' }}
- name: Server metadata
id: metadata_server
uses: docker/metadata-action@v3
with:
images: ${{ env.IMG_NAME_SERVER }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value={{sha}},enable=${{ github.ref_type != 'tag' }}
- name: Log in to Docker Hub
uses: docker/login-action@v1
if: ${{ github.ref_type == 'tag' }}
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Client Docker image
uses: docker/build-push-action@v2
with:
context: client
file: client/Dockerfile.prod
push: ${{ github.event.base_ref =='refs/heads/master' && github.ref_type == 'tag' && !startsWith(github.ref, 'refs/tags/v0.')}}
tags: ${{ steps.metadata_client.outputs.tags }}
labels: ${{ steps.metadata_client.outputs.labels }}
- name: Build and push Server Docker image
uses: docker/build-push-action@v2
with:
context: server
file: server/Dockerfile
push: ${{ github.event.base_ref =='refs/heads/master' && github.ref_type == 'tag' && !startsWith(github.ref, 'refs/tags/v0.')}}
tags: ${{ steps.metadata_server.outputs.tags }}
labels: ${{ steps.metadata_server.outputs.labels }}