Skip to content

...

... #106

Workflow file for this run

name: Docker Image CI
on:
push:
branches: ["feature/bump-up", "master"]
pull_request:
branches: [master]
jobs:
prepare:
runs-on: ubuntu-latest
steps:
- id: env-setup
run: |
export image_tag=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
export image_tag=$(echo $image_tag | tr / -)
echo "image_tag=$image_tag" >> $GITHUB_OUTPUT
outputs:
image_tag: ${{ steps.env-setup.outputs.image_tag }}
commons:
runs-on: ubuntu-latest
needs: prepare
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
#- name: Build the Docker image
# run: docker build -f ./images/commons/Dockerfile -t vscode-commons:$(date +%s) ./images/commons/.
- id: build
name: Push to GitHub Packages
uses: docker/build-push-action@v5.0.0
with:
context: ./images/commons/.
tags: ghcr.io/nolte/vscode-devcontainers/commons:${{ needs.prepare.outputs.image_tag }}
outputs: type=docker,dest=/tmp/commons.tar
load: true
push: true
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: commons
path: /tmp/commons.tar
devops:
runs-on: ubuntu-latest
needs: [commons,prepare]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: commons
path: /tmp
- name: Load image
run: |
# docker buildx use default
echo "Tag"
echo ${{ needs.prepare.outputs.image_tag }}
echo "---"
docker load --input /tmp/commons.tar
echo "---"
docker image ls -a
echo "---"
- name: Push to GitHub Packages
uses: docker/build-push-action@v5.0.0
with:
load: true
context: ./images/devops/.
tags: ghcr.io/nolte/vscode-devcontainers/devops:${{ needs.prepare.outputs.image_tag }}
build-args: FROM_IMAGE_VERSION=${{ needs.prepare.outputs.image_tag }}
push: true
commonsgolang:
runs-on: ubuntu-latest
needs: [commons,prepare]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: commons
path: /tmp
- name: Load image
run: |
docker load --input /tmp/commons.tar
- name: Push to GitHub Packages
uses: docker/build-push-action@v5.0.0
with:
context: ./images/commons-golang/.
tags: ghcr.io/nolte/vscode-devcontainers/commons-golang:${{ needs.prepare.outputs.image_tag }}
outputs: type=docker,dest=/tmp/commons-golang.tar
build-args: FROM_IMAGE_VERSION=${{ needs.prepare.outputs.image_tag }}
load: true
push: true
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: commons-golang
path: /tmp/commons-golang.tar
python:
runs-on: ubuntu-latest
needs: [commonsgolang,prepare]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: commons-golang
path: /tmp
- name: Load image
run: |
docker load --input /tmp/commons-golang.tar
- name: Push to GitHub Packages
uses: docker/build-push-action@v5.0.0
with:
context: ./images/python/.
tags: ghcr.io/nolte/vscode-devcontainers/python:${{ needs.prepare.outputs.image_tag }}
build-args: FROM_IMAGE_VERSION=${{ needs.prepare.outputs.image_tag }}
load: true
push: true