-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Workflow for build and push docker images (#8)
* Create push_docker_images.yml * test push image * test push image * test push image * test push image * test push image * test push image * test push image * test push image * test push image * test push image * test push image * test push image * test push image * test push image * test push image * test push image * test push image * test push image * test push image * test push image
- Loading branch information
1 parent
29fa2e3
commit b37fe7e
Showing
3 changed files
with
92 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
name: Build and Push Docker Images | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
tags: | ||
- 'v*' | ||
pull_request: | ||
branches: | ||
- 'main' | ||
|
||
jobs: | ||
|
||
build_backend: | ||
name: Build and Push Backend | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 | ||
with: | ||
images: linea/pzserver | ||
tags: | | ||
type=raw,enable=${{ startsWith(github.ref, 'refs/tags/v') }},priority=100,prefix=backend_,value=latest | ||
type=semver,enable=true,priority=200,prefix=backend_v,suffix=,pattern={{version}} | ||
type=sha,enable=true,priority=300,prefix=backend_,suffix=,format=short | ||
flavor: | | ||
latest=false | ||
- name: Log in to Docker Hub | ||
if: github.event_name != 'pull_request' | ||
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc | ||
with: | ||
context: ./backend | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
build_frontend: | ||
name: Build and Push Frontend | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 | ||
with: | ||
images: linea/pzserver | ||
tags: | | ||
type=raw,enable=${{ startsWith(github.ref, 'refs/tags/v') }},priority=100,prefix=frontend_,value=latest | ||
type=semver,enable=true,priority=200,prefix=frontend_v,suffix=,pattern={{version}} | ||
type=sha,enable=true,priority=300,prefix=frontend_,suffix=,format=short | ||
flavor: | | ||
latest=false | ||
- name: Log in to Docker Hub | ||
if: github.event_name != 'pull_request' | ||
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc | ||
with: | ||
context: ./frontend | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters