updat epush
This commit is contained in:
+48
-28
@@ -1,64 +1,84 @@
|
|||||||
################################################################################
|
################################################################################
|
||||||
# build
|
# my118/5
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
name: (build dev) build form and push to artifactory
|
name: (dev) build form and push to artifactory
|
||||||
|
clone:
|
||||||
|
depth: 1
|
||||||
steps:
|
steps:
|
||||||
- name: build tag
|
- name: build golang app admin and user
|
||||||
image: alpine/git:2.40.1
|
image: docker-mirror.ravanertebat.ir/hub/golang:1.24
|
||||||
environment:
|
environment:
|
||||||
GOOS: linux
|
GOOS: linux
|
||||||
GOARCH: amd64
|
GOARCH: amd64
|
||||||
CGO_ENABLED: 0
|
CGO_ENABLED: 0
|
||||||
|
GOPROXY: "https://mirror.ravanertebat.ir/repository/golang-proxy,direct"
|
||||||
|
GOSUMDB: "sum.golang.org https://mirror.ravanertebat.ir/repository/golang-sum-proxy"
|
||||||
|
# GOINSECURE: "10.64.16.1"
|
||||||
|
# GOPRIVATE: "10.64.16.1"
|
||||||
settings:
|
settings:
|
||||||
debug: true
|
debug: true
|
||||||
commands:
|
commands:
|
||||||
- APP_VERSION=$(git rev-list HEAD --count --no-merges)-$DRONE_BRANCH
|
- |
|
||||||
|
set -e
|
||||||
|
case "$DRONE_BRANCH" in
|
||||||
|
main) echo prod;;
|
||||||
|
uat) echo uat;;
|
||||||
|
dev) echo dev;;
|
||||||
|
*) echo dev;;
|
||||||
|
esac > .environment
|
||||||
|
- echo "Branch ${DRONE_BRANCH}, Environment $(cat .environment)"
|
||||||
|
- APP_VERSION=$(cat .environment)-${DRONE_BUILD_NUMBER}
|
||||||
- echo "APP Version tags $APP_VERSION"
|
- echo "APP Version tags $APP_VERSION"
|
||||||
- echo -n "$APP_VERSION" >> .tags
|
- echo -n "$APP_VERSION,latest" >> .tags
|
||||||
- name: build web
|
- mkdir -p ./artifacts/go/bin ./artifacts/go/config
|
||||||
image: plugins/docker
|
- go env
|
||||||
settings:
|
- CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -o ./artifacts/go/bin/web ./cmd/web/main.go
|
||||||
build_args:
|
- CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -o ./artifacts/go/bin/scraper ./cmd/scraper/main.go
|
||||||
- BUILD_APP=web
|
- CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -o ./artifacts/go/bin/worker ./cmd/worker/main.go
|
||||||
username: cicd
|
- ls -ltrh ./artifacts/go/bin/
|
||||||
password:
|
|
||||||
from_secret: REGISTRY_PASSWORD
|
|
||||||
dockerfile: ./cmd/web/Dockerfile
|
|
||||||
repo: artifactory.ravanertebat.ir/tm/web
|
|
||||||
registry: artifactory.ravanertebat.ir
|
|
||||||
|
|
||||||
- name: build scraper
|
- name: push scraper
|
||||||
image: plugins/docker
|
image: plugins/docker
|
||||||
settings:
|
settings:
|
||||||
build_args:
|
debug: true
|
||||||
- BUILD_APP=scraper
|
|
||||||
username: cicd
|
username: cicd
|
||||||
password:
|
password:
|
||||||
from_secret: REGISTRY_PASSWORD
|
from_secret: REGISTRY_PASSWORD
|
||||||
dockerfile: ./cmd/scraper/Dockerfile
|
|
||||||
repo: artifactory.ravanertebat.ir/tm/scraper
|
repo: artifactory.ravanertebat.ir/tm/scraper
|
||||||
registry: artifactory.ravanertebat.ir
|
registry: artifactory.ravanertebat.ir
|
||||||
|
dockerfile: ./cmd/scraper/Dockerfile
|
||||||
|
|
||||||
- name: build worker
|
- name: push web
|
||||||
image: plugins/docker
|
image: plugins/docker
|
||||||
settings:
|
settings:
|
||||||
build_args:
|
debug: true
|
||||||
- BUILD_APP=worker
|
username: cicd
|
||||||
|
password:
|
||||||
|
from_secret: REGISTRY_PASSWORD
|
||||||
|
repo: artifactory.ravanertebat.ir/tm/web
|
||||||
|
registry: artifactory.ravanertebat.ir
|
||||||
|
dockerfile: ./cmd/web/Dockerfile
|
||||||
|
|
||||||
|
- name: push worker
|
||||||
|
image: plugins/docker
|
||||||
|
settings:
|
||||||
|
debug: true
|
||||||
username: cicd
|
username: cicd
|
||||||
password:
|
password:
|
||||||
from_secret: REGISTRY_PASSWORD
|
from_secret: REGISTRY_PASSWORD
|
||||||
dockerfile: ./cmd/worker/Dockerfile
|
|
||||||
repo: artifactory.ravanertebat.ir/tm/worker
|
repo: artifactory.ravanertebat.ir/tm/worker
|
||||||
registry: artifactory.ravanertebat.ir
|
registry: artifactory.ravanertebat.ir
|
||||||
|
dockerfile: ./cmd/worker/Dockerfile
|
||||||
node:
|
node:
|
||||||
tag: aecde-docker-runner
|
tag: aecde-docker-runner
|
||||||
trigger:
|
trigger:
|
||||||
branch:
|
branch:
|
||||||
- main
|
- main
|
||||||
- develop
|
- uat
|
||||||
|
- dev
|
||||||
event:
|
event:
|
||||||
|
- promote
|
||||||
- custom
|
- custom
|
||||||
+20
-17
@@ -1,22 +1,25 @@
|
|||||||
ARG GO_VERSION=1.23
|
|
||||||
ARG BASH_VERSION=5.0
|
ARG BASH_VERSION=5.0
|
||||||
|
|
||||||
FROM golang:${GO_VERSION} AS go-builder
|
FROM docker-mirror.ravanertebat.ir/base/amd64/bash:$BASH_VERSION
|
||||||
|
|
||||||
WORKDIR /app
|
## all below action added to base image @Dockerfile.bash-base
|
||||||
|
# #ADD ./fastest-mirror.sh /etc/apk/
|
||||||
|
# #RUN chmod +x /etc/apk/fastest-mirror.sh \
|
||||||
|
# # && /etc/apk/fastest-mirror.sh
|
||||||
|
# RUN apk update
|
||||||
|
# # RUN apk add --upgrade busybox-suid
|
||||||
|
# RUN apk --no-cache add --update busybox-suid \
|
||||||
|
# && apk --no-cache add curl rsync tzdata tcpdump tree ca-certificates s-nail \
|
||||||
|
# && ln -s /usr/bin/mail /usr/bin/s-nail \
|
||||||
|
# && mkdir -p /go/bin/media \
|
||||||
|
# && mkdir -p /go/bin/log \
|
||||||
|
# && mkdir -p /go/bin/config
|
||||||
|
WORKDIR /go/bin/
|
||||||
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -o scraper-build ./cmd/scraper/main.go
|
## Copy pre-built artifacts from Drone CI build steps
|
||||||
|
COPY ./artifacts/go/bin/scraper .
|
||||||
FROM bash:${BASH_VERSION}
|
# COPY ./artifacts/go/config/*.json ./config/
|
||||||
RUN apk --no-cache add busybox-suid curl rsync tzdata tcpdump tree ca-certificates s-nail \
|
EXPOSE 8686
|
||||||
&& ln -s /usr/bin/mail /usr/bin/s-nail
|
# Set the binary.
|
||||||
|
ENTRYPOINT ["/go/bin/scraper"]
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
COPY --from=go-builder /app/scraper-build .
|
|
||||||
|
|
||||||
EXPOSE 80
|
|
||||||
|
|
||||||
ENTRYPOINT /app/scraper-build
|
|
||||||
|
|||||||
+22
-16
@@ -1,24 +1,30 @@
|
|||||||
ARG GO_VERSION=1.23
|
|
||||||
ARG BASH_VERSION=5.0
|
ARG BASH_VERSION=5.0
|
||||||
|
|
||||||
FROM golang:${GO_VERSION} AS go-builder
|
FROM docker-mirror.ravanertebat.ir/base/amd64/bash:$BASH_VERSION
|
||||||
|
|
||||||
WORKDIR /app
|
## all below action added to base image @Dockerfile.bash-base
|
||||||
|
# #ADD ./fastest-mirror.sh /etc/apk/
|
||||||
|
# #RUN chmod +x /etc/apk/fastest-mirror.sh \
|
||||||
|
# # && /etc/apk/fastest-mirror.sh
|
||||||
|
# RUN apk update
|
||||||
|
# # RUN apk add --upgrade busybox-suid
|
||||||
|
# RUN apk --no-cache add --update busybox-suid \
|
||||||
|
# && apk --no-cache add curl rsync tzdata tcpdump tree ca-certificates s-nail \
|
||||||
|
# && ln -s /usr/bin/mail /usr/bin/s-nail \
|
||||||
|
# && mkdir -p /go/bin/media \
|
||||||
|
# && mkdir -p /go/bin/log \
|
||||||
|
# && mkdir -p /go/bin/config
|
||||||
|
WORKDIR /go/bin/
|
||||||
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -o web-build ./cmd/web/main.go
|
## Copy pre-built artifacts from Drone CI build steps
|
||||||
|
COPY ./artifacts/go/bin/web .
|
||||||
|
COPY ./cmd/web/assets ./assets
|
||||||
|
COPY ./app/cmd/web/docs ./docs
|
||||||
|
# COPY ./artifacts/go/config/*.json ./config/
|
||||||
|
EXPOSE 8686
|
||||||
|
# Set the binary.
|
||||||
|
ENTRYPOINT ["/go/bin/web"]
|
||||||
|
|
||||||
FROM bash:${BASH_VERSION}
|
|
||||||
RUN apk --no-cache add busybox-suid curl rsync tzdata tcpdump tree ca-certificates s-nail \
|
|
||||||
&& ln -s /usr/bin/mail /usr/bin/s-nail
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
COPY --from=go-builder /app/web-build .
|
|
||||||
COPY --from=go-builder /app/cmd/web/assets ./assets
|
|
||||||
COPY --from=go-builder /app/cmd/web/docs ./docs
|
|
||||||
|
|
||||||
EXPOSE 80
|
|
||||||
|
|
||||||
ENTRYPOINT /app/web-build
|
|
||||||
|
|||||||
+19
-14
@@ -1,22 +1,27 @@
|
|||||||
ARG GO_VERSION=1.23
|
|
||||||
ARG BASH_VERSION=5.0
|
ARG BASH_VERSION=5.0
|
||||||
|
|
||||||
FROM golang:${GO_VERSION} AS go-builder
|
FROM docker-mirror.ravanertebat.ir/base/amd64/bash:$BASH_VERSION
|
||||||
|
|
||||||
WORKDIR /app
|
## all below action added to base image @Dockerfile.bash-base
|
||||||
|
# #ADD ./fastest-mirror.sh /etc/apk/
|
||||||
|
# #RUN chmod +x /etc/apk/fastest-mirror.sh \
|
||||||
|
# # && /etc/apk/fastest-mirror.sh
|
||||||
|
# RUN apk update
|
||||||
|
# # RUN apk add --upgrade busybox-suid
|
||||||
|
# RUN apk --no-cache add --update busybox-suid \
|
||||||
|
# && apk --no-cache add curl rsync tzdata tcpdump tree ca-certificates s-nail \
|
||||||
|
# && ln -s /usr/bin/mail /usr/bin/s-nail \
|
||||||
|
# && mkdir -p /go/bin/media \
|
||||||
|
# && mkdir -p /go/bin/log \
|
||||||
|
# && mkdir -p /go/bin/config
|
||||||
|
WORKDIR /go/bin/
|
||||||
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -o worker-build ./cmd/worker/main.go
|
## Copy pre-built artifacts from Drone CI build steps
|
||||||
|
COPY ./artifacts/go/bin/worker .
|
||||||
|
EXPOSE 8686
|
||||||
|
# Set the binary.
|
||||||
|
ENTRYPOINT ["/go/bin/worker"]
|
||||||
|
|
||||||
FROM bash:${BASH_VERSION}
|
|
||||||
RUN apk --no-cache add busybox-suid curl rsync tzdata tcpdump tree ca-certificates s-nail \
|
|
||||||
&& ln -s /usr/bin/mail /usr/bin/s-nail
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
COPY --from=go-builder /app/worker-build .
|
|
||||||
|
|
||||||
EXPOSE 80
|
|
||||||
|
|
||||||
ENTRYPOINT /app/worker-build
|
|
||||||
|
|||||||
Reference in New Issue
Block a user