Skip to content

Commit

Permalink
split dev images to separate workflow, also build server dev images
Browse files Browse the repository at this point in the history
  • Loading branch information
detjensrobert committed Jul 19, 2023
1 parent 7fdd1a7 commit 9ca1fbe
Show file tree
Hide file tree
Showing 2 changed files with 103 additions and 49 deletions.
102 changes: 102 additions & 0 deletions .github/workflows/dev_images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Build images for GHCR
on: [push]
env:
# NOTE keep versions in sync with version in TOSCA templates
TERRAFORM_VERSION: 1.1.4 # sync with tosca_plugins/artifacts.yaml
HELM_VERSION: 3.7.1 # sync with configurators/helm-template.yaml
GCLOUD_VERSION: 398.0.0 # sync with tosca_plugins/artifacts.yaml and Dockerfile
KOMPOSE_VERSION: v1.26.1 # sync with Dockerfile
KUBECTL_VERSION: v1.24.2
K3D_VERSION: v4.4.6

jobs:
publish_ghcr:
runs-on: ubuntu-latest
steps:
- name: Fetch repo
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0

- name: Log in to registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: https://ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/onecommons/unfurl
# commit sha, branch name, tag name, latest on main
tags: |
type=sha,prefix=,suffix=-server
type=ref,event=branch,suffix=-server
type=ref,event=tag,suffix=-server
type=raw,value=latest,suffix=-server,enable={{is_default_branch}}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build and push
id: docker_build
uses: docker/build-push-action@v4
with:
context: ./
file: ./docker/Dockerfile.server
push: true
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max

publish_ghcr_server:
runs-on: ubuntu-latest
steps:
- name: Fetch repo
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0

- name: Log in to registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: https://ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/onecommons/unfurl
# commit sha, branch name, tag name, latest on main
tags: |
type=sha,prefix=
type=ref,event=branch
type=ref,event=tag
type=raw,value=latest,enable={{is_default_branch}}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build and push
id: docker_build
uses: docker/build-push-action@v4
with:
context: ./
file: ./docker/Dockerfile
push: true
build-args: |
HELM_VERSION=${{ env.HELM_VERSION }}
TERRAFORM_VERSION=${{ env.TERRAFORM_VERSION }}
GCLOUD_VERSION=${{ env.GCLOUD_VERSION }}
KOMPOSE_VERSION=${{ env.KOMPOSE_VERSION }}
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
50 changes: 1 addition & 49 deletions .github/workflows/on_push.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: test and push docker image
name: Test and Build
on: [push]
env:
# NOTE keep versions in sync with version in TOSCA templates
Expand Down Expand Up @@ -284,51 +284,3 @@ jobs:
branch: gh-pages
directory: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}

publish_dev_ghcr:
runs-on: ubuntu-latest
steps:
- name: Fetch repo
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0

- name: Log in to registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: https://ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/onecommons/unfurl
# commit sha, branch name, tag name, latest on main
tags: |
type=sha,prefix=
type=ref,event=branch
type=ref,event=tag
type=raw,value=latest,enable={{is_default_branch}}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build and push
id: docker_build
uses: docker/build-push-action@v4
with:
context: ./
file: ./docker/Dockerfile
push: true
build-args: |
HELM_VERSION=${{ env.HELM_VERSION }}
TERRAFORM_VERSION=${{ env.TERRAFORM_VERSION }}
GCLOUD_VERSION=${{ env.GCLOUD_VERSION }}
KOMPOSE_VERSION=${{ env.KOMPOSE_VERSION }}
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max

0 comments on commit 9ca1fbe

Please sign in to comment.