add cache

This commit is contained in:
k.pirzargar
2025-08-30 23:34:15 +03:30
parent 3034018ebd
commit ea52e87443
+89 -44
View File
@@ -1,52 +1,97 @@
################################################################################ # ################################################################################
# web # # web
################################################################################ # ################################################################################
# kind: pipeline
# type: docker
# name: (web dev) build form and push to artifactory
# steps:
# - name: tag
# image: alpine/git:2.40.1
# environment:
# GOOS: linux
# GOARCH: amd64
# CGO_ENABLED: 0
# settings:
# debug: true
# commands:
# - APP_VERSION=$(git rev-list HEAD --count --no-merges)-$DRONE_BRANCH
# - echo "APP Version tags $APP_VERSION"
# - echo -n "$APP_VERSION" >> .tags
# - name: buid web
# image: plugins/docker
# settings:
# build_args:
# - BUILD_APP=web
# username: cicd
# password:
# from_secret: REGISTRY_PASSWORD
# dockerfile: Dockerfile-drone
# repo: artifactory.ravanertebat.ir/tm/web
# registry: artifactory.ravanertebat.ir
# - name: buid scraper
# image: plugins/docker
# settings:
# build_args:
# - BUILD_APP=scraper
# username: cicd
# password:
# from_secret: REGISTRY_PASSWORD
# dockerfile: Dockerfile-drone
# repo: artifactory.ravanertebat.ir/tm/scraper
# registry: artifactory.ravanertebat.ir
# node:
# tag: aecde-docker-runner
# trigger:
# branch:
# - develop
# event:
# - custom
kind: pipeline kind: pipeline
type: docker type: docker
name: (web dev) build form and push to artifactory name: go-pipeline
steps: steps:
- name: tag - name: install-deps
image: alpine/git:2.40.1 image: golang:1.21
environment: volumes:
GOOS: linux - name: gocache
GOARCH: amd64 path: /go/pkg/mod
CGO_ENABLED: 0 - name: gobuild
settings: path: /root/.cache/go-build
debug: true
commands: commands:
- APP_VERSION=$(git rev-list HEAD --count --no-merges)-$DRONE_BRANCH - go mod download
- echo "APP Version tags $APP_VERSION"
- echo -n "$APP_VERSION" >> .tags
- name: buid web - name: build-web
image: plugins/docker image: golang:1.21
settings: volumes:
build_args: - name: gocache
- BUILD_APP=web path: /go/pkg/mod
username: cicd - name: gobuild
password: path: /root/.cache/go-build
from_secret: REGISTRY_PASSWORD commands:
dockerfile: Dockerfile-drone - go build -o build/web ./cmd/web
repo: artifactory.ravanertebat.ir/tm/web
registry: artifactory.ravanertebat.ir
- name: buid scraper - name: build-scraper
image: plugins/docker image: golang:1.21
settings: volumes:
build_args: - name: gocache
- BUILD_APP=scraper path: /go/pkg/mod
username: cicd - name: gobuild
password: path: /root/.cache/go-build
from_secret: REGISTRY_PASSWORD commands:
dockerfile: Dockerfile-drone - go build -o build/scraper ./cmd/scraper
repo: artifactory.ravanertebat.ir/tm/scraper
registry: artifactory.ravanertebat.ir
node: volumes:
tag: aecde-docker-runner - name: gocache
trigger: host:
branch: path: /opt/drone/cache/go
- develop - name: gobuild
event: host:
- custom path: /opt/drone/cache/go-build