Skip to content
Permalink
main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
View runs Go to file
 
 
Cannot retrieve contributors at this time
name: EOEFANS SPIDER Docker Image CI
on:
push:
tags: ["v*.*.*"]
# workflow_dispatch:
env:
IMAGE_REGISTRY: "containers.vlink.dev"
IMAGE_REPO: "eoefans"
IMAGE_NAME: "eoefans-spider"
DOCKERFILE_PATH: "./builder/spider/Dockerfile"
# IMAGE_TAG: "" #we get tag using the action down below
jobs:
build:
runs-on: [ self-hosted, Linux ]
steps:
- uses: actions/checkout@v3
- name: Get tag
id: tag
uses: dawidd6/action-get-tag@v1
- run: |
echo "IMAGE_TAG=${{steps.tag.outputs.tag}}" >> $GITHUB_ENV
echo "$GITHUB_ENV"
- name: write the version to local file (config/version)
run: |
echo "$IMAGE_TAG" > config/version
ls config
cat config/version
- uses: actions/setup-go@main
with:
go-version-file: './go.mod'
cache-dependency-path: ./go.sum
cache: true
- run: go version
- id: go-cache-paths
run: |
echo "::set-output name=go-build::$(go env GOCACHE)"
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
# Cache go build cache, used to speedup go test
- name: Go Build Cache
uses: actions/cache@v3
with:
path: ${{ steps.go-cache-paths.outputs.go-build }}
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
# Cache go mod cache, used to speedup builds
- name: Go Mod Cache
uses: actions/cache@v3
with:
path: ${{ steps.go-cache-paths.outputs.go-mod }}
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
- name: go dependencies
run: go mod download
- name: go build
run: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GOARM=6 go build -ldflags '-w -s' -o spider vlink.dev/eoefans/cmd/spider
- name: Log in to VLINK Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.IMAGE_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build the Docker image with tag
run: docker build . --file ${{ env.DOCKERFILE_PATH }} --tag ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_REPO }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
- name: push docker image with tag
run: docker push ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_REPO }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
- name: re-tag the image to latest version
run: docker tag ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_REPO }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_REPO }}/${{ env.IMAGE_NAME }}:latest
- name: push latest docker image
run: docker push ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_REPO }}/${{ env.IMAGE_NAME }}:latest