Files
tm_back/.drone.yml
T
mazyar 9674d571e2
continuous-integration/drone/push Build is passing
Update .drone.yml
2026-06-13 13:22:26 +00:00

72 lines
2.0 KiB
YAML

kind: pipeline
type: docker
name: build-and-push
clone:
depth: 1
steps:
- name: build golang app
image: golang:1.24
environment:
GOOS: linux
GOARCH: amd64
CGO_ENABLED: 0
commands:
- |
set -e
SHORT_SHA=$(echo "$DRONE_COMMIT_SHA" | cut -c1-8)
IMG_TAG="${DRONE_BUILD_NUMBER}-${DRONE_BRANCH}"
echo -n "$IMG_TAG,$SHORT_SHA" > .tags
echo "Image tags -> $IMG_TAG , $SHORT_SHA"
- mkdir -p ./artifacts/go/bin ./artifacts/go/config
- go env
- CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -o ./artifacts/go/bin/web ./cmd/web/main.go
- CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -o ./artifacts/go/bin/scraper ./cmd/scraper/main.go
- rm -f cmd/worker/workers/scraper.go cmd/worker/workers/scraper_consumer.go cmd/worker/workers/queue_producer.go
- CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -o ./artifacts/go/bin/worker ./cmd/worker/main.go
- cp -r ./cmd/web/docs ./artifacts/go/bin/docs
- cp -r ./cmd/web/assets ./artifacts/go/bin/assets
- ls -ltrh ./artifacts/go/bin/
- name: push web
image: plugins/docker
settings:
registry: git.opplens.se
repo: git.opplens.se/mazyar/web
username:
from_secret: registry_username
password:
from_secret: registry_password
dockerfile: ./cmd/web/Dockerfile
- name: push scraper
image: plugins/docker
settings:
registry: git.opplens.se
repo: git.opplens.se/mazyar/scraper
username:
from_secret: registry_username
password:
from_secret: registry_password
dockerfile: ./cmd/scraper/Dockerfile
- name: push worker
image: plugins/docker
settings:
registry: git.opplens.se
repo: git.opplens.se/mazyar/worker
username:
from_secret: registry_username
password:
from_secret: registry_password
dockerfile: ./cmd/worker/Dockerfile
trigger:
branch:
- main
- uat
- dev
event:
- push