Skip to content

Test new GitHub actions using bake #6

Test new GitHub actions using bake

Test new GitHub actions using bake #6

name: Build the Docker images
on:
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Initialize environment
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: |
sed -e '/^[[:space:]]*$/d' -e '/[#@]/d' -e 's/\"//g' -e 's/\(^[^=]*\)=\(.*\)/\1="\2"/' template.env > env.hcl
export DOCKER_IMG_TAG=`echo "${{ github.sha }}" | cut -c 1-7`
export DOCKER_USERNAME=local
echo "::set-env name=DOCKER_IMG_TAG::$DOCKER_IMG_TAG"
echo "::set-env name=DOCKER_USERNAME::$DOCKER_USERNAME"
- name: Build and push
uses: docker/bake-action@v4
with:
push: false
files: docker-bake.hcl, env.hcl
# - name: Build the Docker images
# env:
# GITHUB_CONTEXT: ${{ toJson(github) }}
# run: |
# # Initialize variables
# DOCKER_IMG_TAG=`echo "${{ github.sha }}" | cut -c 1-7`
# # Create the environment
# sed -e '/^[[:space:]]*$/d' -e '/[#@]/d' -e 's/\"//g' -e 's/\(^[^=]*\)=\(.*\)/\1="\2"/' template.env > env.hcl
# # Build and Push
# DOCKER_IMG_TAG=$DOCKER_IMG_TAG DOCKER_USERNAME=local docker buildx bake -f docker-bake.hcl -f env.hcl