This commit is contained in:
28
.woodpecker.yml
Normal file
28
.woodpecker.yml
Normal file
@ -0,0 +1,28 @@
|
||||
steps:
|
||||
build:
|
||||
image: plugins/kaniko
|
||||
settings:
|
||||
repo: gitea.hottis.de/wn/locsrv
|
||||
registry:
|
||||
from_secret: container_registry
|
||||
tags: latest,${CI_COMMIT_SHA},${CI_COMMIT_TAG}
|
||||
username:
|
||||
from_secret: container_registry_username
|
||||
password:
|
||||
from_secret: container_registry_password
|
||||
dockerfile: Dockerfile
|
||||
when:
|
||||
- event: [push, tag]
|
||||
|
||||
deploy:
|
||||
image: portainer/kubectl-shell:latest
|
||||
secrets:
|
||||
- source: kube_config
|
||||
target: KUBE_CONFIG_CONTENT
|
||||
commands:
|
||||
- export IMAGE_TAG=$CI_COMMIT_TAG
|
||||
- printf "$KUBE_CONFIG_CONTENT" > /tmp/kubeconfig
|
||||
- export KUBECONFIG=/tmp/kubeconfig
|
||||
- cat ./deployment/install-yml.tmpl | sed -e 's,%IMAGETAG%,'$IMAGE_TAG','g | kubectl apply -f -
|
||||
when:
|
||||
- event: tag
|
16
Dockerfile
Normal file
16
Dockerfile
Normal file
@ -0,0 +1,16 @@
|
||||
FROM golang:1.21-alpine as builder
|
||||
|
||||
RUN mkdir -p /go/src
|
||||
COPY ./src/ /go/src
|
||||
WORKDIR /go/src/locsrv
|
||||
RUN go build -a -installsuffix nocgo -o locsrv main.go
|
||||
|
||||
|
||||
FROM scratch
|
||||
|
||||
ENV UDI_CONF ""
|
||||
|
||||
COPY --from=builder /go/src/locsrv ./
|
||||
ENTRYPOINT ["./locsrv"]
|
||||
|
||||
|
25
deployment/install-yml.tmpl
Normal file
25
deployment/install-yml.tmpl
Normal file
@ -0,0 +1,25 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: homea
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: locsrv
|
||||
namespace: homea
|
||||
labels:
|
||||
app: locsrv
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: locsrv
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: locsrv
|
||||
spec:
|
||||
containers:
|
||||
- name: locsrv
|
||||
image: gitea.hottis.de/wn/locsrv:%IMAGETAG%
|
Reference in New Issue
Block a user