-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
csalialtog
committed
Oct 15, 2024
1 parent
073b1cb
commit d7a5990
Showing
2 changed files
with
44 additions
and
18 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 |
---|---|---|
@@ -1,28 +1,37 @@ | ||
name: Main | ||
name: Build and Push sqlapi | ||
|
||
on: [push] | ||
|
||
env: | ||
NAME: techciceksepeti/sqlapi | ||
VERSION_PREFIX: 2.0 | ||
DOCKER_USER: ${{ secrets.DOCKER_USER }} | ||
DOCKER_PASS: ${{ secrets.DOCKER_PASS }} | ||
on: | ||
push | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
SQLAPI: techciceksepeti/sqlapi | ||
TAG_SQLAPI: 2.8-multi-platform | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Build | ||
- name: Set environment variables | ||
env: | ||
SECRETS_CONTEXT: ${{ toJson(secrets) }} | ||
run: | | ||
docker build --rm=false -t $NAME . | ||
docker tag $NAME $NAME:latest | ||
docker tag $NAME $NAME:$VERSION_PREFIX.$GITHUB_RUN_NUMBER | ||
echo "$SECRETS_CONTEXT" | jq -r 'to_entries[] | "\(.key)=\(.value)"' >> $GITHUB_ENV | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
with: | ||
driver: docker-container | ||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_USER }} | ||
password: ${{ secrets.DOCKER_PASS }} | ||
|
||
- name: Push | ||
- name: Build and Push sqlapi Docker Image | ||
run: | | ||
docker login -u $DOCKER_USER -p $DOCKER_PASS | ||
docker push $NAME:latest | ||
docker push $NAME:$VERSION_PREFIX.$GITHUB_RUN_NUMBER | ||
bash ./build-image-multi-platform.sh $SQLAPI Dockerfile $TAG_SQLAPI |
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,17 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
NAME=$1 | ||
DOCKERFILE=$2 | ||
TAG=$3 | ||
PLATFORM=${4:-linux/amd64,linux/arm64} # Default platform is linux/amd64 and linux/arm64 if not specified | ||
|
||
if [ $TAG ]; then | ||
echo "Building dockerfile $DOCKERFILE for $NAME:$TAG on platforms $PLATFORM" | ||
docker buildx build --rm=false --file ./images/$DOCKERFILE --platform $PLATFORM -t $NAME:$TAG ./images/. --push | ||
else | ||
echo "Building dockerfile $DOCKERFILE for $NAME on platforms $PLATFORM" | ||
docker buildx build --rm=false --file ./images/$DOCKERFILE --platform $PLATFORM -t $NAME ./images/. --push | ||
docker tag $NAME $NAME:latest | ||
docker tag $NAME $NAME:$BUILDPREFIX$GITHUB_RUN_NUMBER | ||
fi |