This commit is contained in:
38
.gitea/workflows/docker-build.yaml
Normal file
38
.gitea/workflows/docker-build.yaml
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
name: Build docker image
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
helm-lint:
|
||||||
|
runs-on: docker
|
||||||
|
steps:
|
||||||
|
- name: Clone repo
|
||||||
|
run: |
|
||||||
|
echo "Cloning repository $GITHUB_REPOSITORY..."
|
||||||
|
git clone "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git" "$GITHUB_WORKSPACE"
|
||||||
|
cd "$GITHUB_WORKSPACE"
|
||||||
|
|
||||||
|
- name: Log in to Docker registry
|
||||||
|
run: |
|
||||||
|
# Remove https:// from GITHUB_SERVER_URL
|
||||||
|
REGISTRY="${GITHUB_SERVER_URL#https://}"
|
||||||
|
echo "${{ secrets.DOCKER_REPO_TOKEN }}" | docker login $REGISTRY -u "${{ secrets.DOCKER_REPO_USER }}" --password-stdin
|
||||||
|
|
||||||
|
- name: Build and tag Docker image
|
||||||
|
run: |
|
||||||
|
COMMIT_HASH=$(echo $GITHUB_SHA | cut -c1-7)
|
||||||
|
REGISTRY="${GITHUB_SERVER_URL#https://}"
|
||||||
|
IMAGE="$REGISTRY/duino-coin-docker/duino-coin"
|
||||||
|
echo "Building Docker image with tags: latest and $COMMIT_HASH"
|
||||||
|
docker build -t $IMAGE:latest -t $IMAGE:$COMMIT_HASH .
|
||||||
|
|
||||||
|
- name: Push Docker image
|
||||||
|
run: |
|
||||||
|
REGISTRY="${GITHUB_SERVER_URL#https://}"
|
||||||
|
IMAGE="$REGISTRY/duino-coin-docker/duino-coin"
|
||||||
|
docker push $IMAGE:latest
|
||||||
|
docker push $IMAGE:$COMMIT_HASH
|
Reference in New Issue
Block a user