Skip to content

Commit

Permalink
chore: Testing a faster dockhub build method
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorfdl committed Jun 20, 2024
1 parent c5f2e12 commit 11cad92
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/build-dockerhub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ on:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
architecture: [arm64, amd64]
environment: PROD

steps:
Expand All @@ -38,9 +41,10 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

# linux/arm64/v8,linux/amd64
- name: Build and deploy images
env:
CARGO_SERVER_SSL_CA: ${{ secrets.SERVER_SSL_CA }}
CARGO_SERVER_SSL_CERT: ${{ secrets.SERVER_SSL_CERT }}
CARGO_SERVER_SSL_KEY: ${{ secrets.SERVER_SSL_KEY }}
run: bash dockerhub.sh ${{ github.event.inputs.version }}
run: bash dockerhub.sh linux/${{ matrix.architecture }} ${{ github.event.inputs.version || github.event.release.tag_name }}
17 changes: 14 additions & 3 deletions dockerhub.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
#!/bin/bash
# Ensure a version is provided
# Ensure a platform is provided
if [ -z "$1" ]; then
echo "Error: No platform provided."
exit 1
fi

# Ensure a version is provided
if [ -z "$2" ]; then
echo "Error: No version provided."
exit 1
fi

FULL_VERSION=$1
PLATFORM=$1
if [ "$PLATFORM" == "linux/arm64" ]; then
PLATFORM="linux/arm64/v8"
fi

FULL_VERSION=$2

SPLIT=(${FULL_VERSION//./ })
MAJOR=${SPLIT[0]}
Expand Down Expand Up @@ -43,7 +54,7 @@ docker buildx build --push --build-arg TAGORELAY_VERSION=${FULL_VERSION} \
--build-arg CARGO_SERVER_SSL_CA=${CARGO_SERVER_SSL_CA_BASE64} \
--build-arg CARGO_SERVER_SSL_CERT=${CARGO_SERVER_SSL_CERT_BASE64} \
--build-arg CARGO_SERVER_SSL_KEY=${CARGO_SERVER_SSL_KEY_BASE64} \
--platform linux/arm64/v8,linux/amd64 \
--platform ${PLATFORM} \
--tag tagoio/relay \
--tag tagoio/relay:debian \
--tag tagoio/relay:bookworm \
Expand Down

0 comments on commit 11cad92

Please sign in to comment.