From 5e5caae6c31f7b0e89d0bed87e7281b5fccd19ab Mon Sep 17 00:00:00 2001 From: itzaname Date: Sat, 14 Dec 2024 02:06:43 -0500 Subject: [PATCH] Add drone ci --- .drone.yml | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++ Containerfile | 3 -- Makefile | 10 ++++-- 3 files changed, 95 insertions(+), 6 deletions(-) create mode 100644 .drone.yml diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..78de308 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,88 @@ +--- +kind: pipeline +type: docker + +platform: + os: linux + arch: amd64 + +steps: + - name: api + image: plugins/docker + settings: + registry: registry.itzana.me + repo: registry.itzana.me/strafesnet/maptest-api + tags: + - ${DRONE_BRANCH}-${DRONE_BUILD_NUMBER} + - ${DRONE_BRANCH} + username: + from_secret: REGISTRY_USER + password: + from_secret: REGISTRY_PASS + dockerfile: Containerfile + context: . + when: + branch: + - master + - staging + + - name: frontend + image: plugins/docker + settings: + registry: registry.itzana.me + repo: registry.itzana.me/strafesnet/maptest-frontend + tags: + - ${DRONE_BRANCH}-${DRONE_BUILD_NUMBER} + - ${DRONE_BRANCH} + username: + from_secret: REGISTRY_USER + password: + from_secret: REGISTRY_PASS + dockerfile: web/Containerfile + context: web + when: + branch: + - master + - staging + + - name: validator + image: plugins/docker + settings: + registry: registry.itzana.me + repo: registry.itzana.me/strafesnet/maptest-validator + tags: + - ${DRONE_BRANCH}-${DRONE_BUILD_NUMBER} + - ${DRONE_BRANCH} + username: + from_secret: REGISTRY_USER + password: + from_secret: REGISTRY_PASS + dockerfile: validation/Containerfile + context: validation + when: + branch: + - master + - staging + + - name: deploy + image: argoproj/argocd:latest + commands: + - echo "Deploy!" # Not going to do actually do this until + environment: + USERNAME: + from_secret: ARGO_USER + PASSWORD: + from_secret: ARGO_PASS + depends_on: + - api + - frontend + - validator + when: + branch: + - master + - staging +--- +kind: signature +hmac: 9958fd5b01af1ebcc75f7277fe71eb5336b899445c359cecf1b14e83b3d05059 + +... diff --git a/Containerfile b/Containerfile index 7203e1b..4843f8a 100644 --- a/Containerfile +++ b/Containerfile @@ -7,9 +7,6 @@ WORKDIR /app # Copy go.mod and go.sum files COPY go.mod go.sum ./ -# Download dependencies -RUN --mount=type=secret,id=netrc,dst=/root/.netrc go mod download - # Copy the entire project COPY . . diff --git a/Makefile b/Makefile index 5a576f4..8225c30 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,12 @@ -.PHONY: maps-service web validation maps-service: - DOCKER_BUILDKIT=1 docker build . -f Containerfile -t maps-service \ - --secret id=netrc,src=/home/quat/.netrc + DOCKER_BUILDKIT=1 docker build . -f Containerfile -t maps-service + web: docker build web -f web/Containerfile -t maps-service-web + validation: docker build validation -f validation/Containerfile -t maps-service-validation + +all: maps-service web validation + +.PHONY: maps-service web validation