Do CI/CD
This commit is contained in:
parent
0f9af99b94
commit
764ac78063
22
.drone-manifest.yml
Normal file
22
.drone-manifest.yml
Normal file
@ -0,0 +1,22 @@
|
||||
image: registry.nemunai.re/reveil:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
|
||||
{{#if build.tags}}
|
||||
tags:
|
||||
{{#each build.tags}}
|
||||
- {{this}}
|
||||
{{/each}}
|
||||
{{/if}}
|
||||
manifests:
|
||||
- image: registry.nemunai.re/reveil:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64
|
||||
platform:
|
||||
architecture: amd64
|
||||
os: linux
|
||||
- image: registry.nemunai.re/reveil:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64
|
||||
platform:
|
||||
architecture: arm64
|
||||
os: linux
|
||||
variant: v8
|
||||
- image: registry.nemunai.re/reveil:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm
|
||||
platform:
|
||||
architecture: arm
|
||||
os: linux
|
||||
variant: v7
|
92
.drone.yml
Normal file
92
.drone.yml
Normal file
@ -0,0 +1,92 @@
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: build-arm
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: arm
|
||||
|
||||
workspace:
|
||||
base: /go
|
||||
path: src/git.nemunai.re/nemunaire/reveil
|
||||
|
||||
steps:
|
||||
- name: build front
|
||||
image: node:18-alpine
|
||||
commands:
|
||||
- mkdir deploy
|
||||
- cd ui
|
||||
- npm install --network-timeout=100000
|
||||
- sed -i 's!@popperjs/core/dist/esm/popper!@popperjs/core!' node_modules/sveltestrap/src/*.js node_modules/sveltestrap/src/*.svelte
|
||||
- npm run build
|
||||
- tar chjf ../deploy/static.tar.bz2 build
|
||||
|
||||
- name: build
|
||||
image: golang:1-alpine
|
||||
commands:
|
||||
- apk --no-cache add alsa-lib-dev build-base git pkgconf
|
||||
- go get -v -d
|
||||
- go vet -v
|
||||
- go build -v -ldflags '-w -X main.Version="${DRONE_BRANCH}-${DRONE_COMMIT}" -X main.build=${DRONE_BUILD_NUMBER}' -o deploy/reveil-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH}
|
||||
- ln deploy/reveil-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} reveil
|
||||
when:
|
||||
event:
|
||||
exclude:
|
||||
- tag
|
||||
|
||||
- name: build tag
|
||||
image: golang:1-alpine
|
||||
commands:
|
||||
- apk --no-cache add alsa-lib-dev build-base git pkgconf
|
||||
- go get -v -d
|
||||
- go vet -v
|
||||
- go build -v -ldflags '-w -X main.Version="${DRONE_TAG##v}" -X main.build=${DRONE_BUILD_NUMBER}' -o deploy/reveil-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH}
|
||||
- ln deploy/reveil-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} reveil
|
||||
when:
|
||||
event:
|
||||
- tag
|
||||
|
||||
- name: docker
|
||||
image: plugins/docker
|
||||
settings:
|
||||
registry: registry.nemunai.re
|
||||
repo: registry.nemunai.re/reveil
|
||||
auto_tag: true
|
||||
auto_tag_suffix: ${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH}
|
||||
dockerfile: Dockerfile-norebuild
|
||||
username:
|
||||
from_secret: docker_username
|
||||
password:
|
||||
from_secret: docker_password
|
||||
|
||||
trigger:
|
||||
event:
|
||||
- cron
|
||||
- push
|
||||
- tag
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
name: docker-manifest
|
||||
|
||||
steps:
|
||||
- name: publish on Docker Hub
|
||||
image: plugins/manifest
|
||||
settings:
|
||||
auto_tag: true
|
||||
ignore_missing: true
|
||||
spec: .drone-manifest.yml
|
||||
username:
|
||||
from_secret: docker_username
|
||||
password:
|
||||
from_secret: docker_password
|
||||
|
||||
trigger:
|
||||
event:
|
||||
- cron
|
||||
- push
|
||||
- tag
|
||||
|
||||
depends_on:
|
||||
- build-arm
|
@ -21,6 +21,9 @@ RUN go get -v && go generate -v && go build -v -ldflags="-s -w"
|
||||
|
||||
FROM alpine:3.16
|
||||
|
||||
VOLUME /data
|
||||
WORKDIR /data
|
||||
|
||||
EXPOSE 8080
|
||||
CMD ["/srv/reveil"]
|
||||
|
||||
|
9
Dockerfile-norebuild
Normal file
9
Dockerfile-norebuild
Normal file
@ -0,0 +1,9 @@
|
||||
FROM alpine:3.16
|
||||
|
||||
VOLUME /data
|
||||
WORKDIR /data
|
||||
|
||||
EXPOSE 8080
|
||||
CMD ["/srv/reveil"]
|
||||
|
||||
COPY reveil /srv/reveil
|
Loading…
Reference in New Issue
Block a user