+35
-12
@@ -1,3 +1,4 @@
|
|||||||
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: kubernetes
|
type: kubernetes
|
||||||
name: default
|
name: default
|
||||||
@@ -10,39 +11,61 @@ trigger:
|
|||||||
- master
|
- master
|
||||||
event:
|
event:
|
||||||
- push
|
- push
|
||||||
|
|
||||||
workspace:
|
workspace:
|
||||||
path: /drone/src
|
path: /drone/src/network-go
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: build multiarch from dev
|
- name: test
|
||||||
|
image: docker.io/library/golang:1.26-alpine
|
||||||
|
pull: always
|
||||||
|
commands:
|
||||||
|
- apk add --no-cache git
|
||||||
|
- cd /drone/src/network-go
|
||||||
|
- go mod download
|
||||||
|
- go test ./... -count=1 -v
|
||||||
|
|
||||||
|
- name: build
|
||||||
|
image: docker.io/library/golang:1.26-alpine
|
||||||
|
pull: always
|
||||||
|
commands:
|
||||||
|
- apk add --no-cache git
|
||||||
|
- cd /drone/src/network-go
|
||||||
|
- go build -o network-go -ldflags="-s -w" .
|
||||||
|
|
||||||
|
- name: build-multiarch
|
||||||
image: docker.io/owncloudci/drone-docker-buildx:4
|
image: docker.io/owncloudci/drone-docker-buildx:4
|
||||||
privileged: true
|
privileged: true
|
||||||
settings:
|
settings:
|
||||||
cache-from: [ "registry.dev.format.hu/firewall" ]
|
cache-from:
|
||||||
|
- registry.dev.format.hu/network-go
|
||||||
registry: registry.dev.format.hu
|
registry: registry.dev.format.hu
|
||||||
repo: registry.dev.format.hu/firewall
|
repo: registry.dev.format.hu/network-go
|
||||||
tags: latest
|
tags: latest
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
|
context: .
|
||||||
username:
|
username:
|
||||||
from_secret: dev-hu-registry-username
|
from_secret: dev-hu-registry-username
|
||||||
password:
|
password:
|
||||||
from_secret: dev-hu-registry-password
|
from_secret: dev-hu-registry-password
|
||||||
platforms:
|
platforms:
|
||||||
- linux/amd64
|
- linux/amd64
|
||||||
- linux/arm64
|
- linux/arm64
|
||||||
|
|
||||||
- name: pull image to dockerhub
|
- name: push-to-dockerhub
|
||||||
image: docker.io/owncloudci/drone-docker-buildx:4
|
image: docker.io/owncloudci/drone-docker-buildx:4
|
||||||
privileged: true
|
privileged: true
|
||||||
settings:
|
settings:
|
||||||
cache-from: [ "safebox/firewall" ]
|
cache-from:
|
||||||
repo: safebox/firewall
|
- safebox/network-go
|
||||||
|
repo: safebox/network-go
|
||||||
tags: latest
|
tags: latest
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
context: .
|
||||||
username:
|
username:
|
||||||
from_secret: dockerhub-username
|
from_secret: dockerhub-username
|
||||||
password:
|
password:
|
||||||
from_secret: dockerhub-password
|
from_secret: dockerhub-password
|
||||||
platforms:
|
platforms:
|
||||||
- linux/amd64
|
- linux/amd64
|
||||||
- linux/arm64
|
- linux/arm64
|
||||||
|
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
kind: pipeline
|
||||||
|
type: kubernetes
|
||||||
|
name: default
|
||||||
|
|
||||||
|
node_selector:
|
||||||
|
physical-node: dev1
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
branch:
|
||||||
|
- master
|
||||||
|
event:
|
||||||
|
- push
|
||||||
|
workspace:
|
||||||
|
path: /drone/src
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: build multiarch from dev
|
||||||
|
image: docker.io/owncloudci/drone-docker-buildx:4
|
||||||
|
privileged: true
|
||||||
|
settings:
|
||||||
|
cache-from: [ "registry.dev.format.hu/firewall" ]
|
||||||
|
registry: registry.dev.format.hu
|
||||||
|
repo: registry.dev.format.hu/firewall
|
||||||
|
tags: latest
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
username:
|
||||||
|
from_secret: dev-hu-registry-username
|
||||||
|
password:
|
||||||
|
from_secret: dev-hu-registry-password
|
||||||
|
platforms:
|
||||||
|
- linux/amd64
|
||||||
|
- linux/arm64
|
||||||
|
|
||||||
|
- name: pull image to dockerhub
|
||||||
|
image: docker.io/owncloudci/drone-docker-buildx:4
|
||||||
|
privileged: true
|
||||||
|
settings:
|
||||||
|
cache-from: [ "safebox/firewall" ]
|
||||||
|
repo: safebox/firewall
|
||||||
|
tags: latest
|
||||||
|
username:
|
||||||
|
from_secret: dockerhub-username
|
||||||
|
password:
|
||||||
|
from_secret: dockerhub-password
|
||||||
|
platforms:
|
||||||
|
- linux/amd64
|
||||||
|
- linux/arm64
|
||||||
|
|
||||||
+23
-4
@@ -1,5 +1,24 @@
|
|||||||
FROM alpine
|
# Build stage
|
||||||
|
FROM docker.io/library/golang:1.26-alpine AS builder
|
||||||
|
|
||||||
RUN apk add --update --no-cache iptables iptables-legacy openssl jq curl ca-certificates busybox-extras docker-cli
|
WORKDIR /build
|
||||||
COPY firewall/ /firewall/
|
COPY go.mod go.sum ./
|
||||||
CMD firewall/iptables-wrapper-installer.sh && /firewall/firewall-add
|
RUN go mod download
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
RUN go build -o network-go -ldflags="-s -w" .
|
||||||
|
|
||||||
|
# Runtime stage
|
||||||
|
FROM docker.io/library/alpine:latest
|
||||||
|
|
||||||
|
RUN apk add --update --no-cache \
|
||||||
|
iptables \
|
||||||
|
iptables-legacy \
|
||||||
|
ca-certificates \
|
||||||
|
util-linux \
|
||||||
|
nsenter \
|
||||||
|
&& rm -rf /var/cache/apk/*
|
||||||
|
|
||||||
|
COPY --from=builder /build/network-go /usr/local/bin/network-go
|
||||||
|
|
||||||
|
CMD ["/usr/local/bin/network-go"]
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
FROM alpine
|
||||||
|
|
||||||
|
RUN apk add --update --no-cache iptables iptables-legacy openssl jq curl ca-certificates busybox-extras docker-cli
|
||||||
|
COPY firewall/ /firewall/
|
||||||
|
CMD firewall/iptables-wrapper-installer.sh && /firewall/firewall-add
|
||||||
@@ -1,71 +0,0 @@
|
|||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
type: kubernetes
|
|
||||||
name: default
|
|
||||||
|
|
||||||
node_selector:
|
|
||||||
physical-node: dev1
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
branch:
|
|
||||||
- master
|
|
||||||
event:
|
|
||||||
- push
|
|
||||||
|
|
||||||
workspace:
|
|
||||||
path: /drone/src/network-go
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: test
|
|
||||||
image: docker.io/library/golang:1.26-alpine
|
|
||||||
pull: always
|
|
||||||
commands:
|
|
||||||
- apk add --no-cache git
|
|
||||||
- cd /drone/src/network-go
|
|
||||||
- go mod download
|
|
||||||
- go test ./... -count=1 -v
|
|
||||||
|
|
||||||
- name: build
|
|
||||||
image: docker.io/library/golang:1.26-alpine
|
|
||||||
pull: always
|
|
||||||
commands:
|
|
||||||
- apk add --no-cache git
|
|
||||||
- cd /drone/src/network-go
|
|
||||||
- go build -o network-go -ldflags="-s -w" .
|
|
||||||
|
|
||||||
- name: build-multiarch
|
|
||||||
image: docker.io/owncloudci/drone-docker-buildx:4
|
|
||||||
privileged: true
|
|
||||||
settings:
|
|
||||||
cache-from:
|
|
||||||
- registry.dev.format.hu/network-go
|
|
||||||
registry: registry.dev.format.hu
|
|
||||||
repo: registry.dev.format.hu/network-go
|
|
||||||
tags: latest
|
|
||||||
dockerfile: Dockerfile
|
|
||||||
context: .
|
|
||||||
username:
|
|
||||||
from_secret: dev-hu-registry-username
|
|
||||||
password:
|
|
||||||
from_secret: dev-hu-registry-password
|
|
||||||
platforms:
|
|
||||||
- linux/amd64
|
|
||||||
- linux/arm64
|
|
||||||
|
|
||||||
- name: push-to-dockerhub
|
|
||||||
image: docker.io/owncloudci/drone-docker-buildx:4
|
|
||||||
privileged: true
|
|
||||||
settings:
|
|
||||||
cache-from:
|
|
||||||
- safebox/network-go
|
|
||||||
repo: safebox/network-go
|
|
||||||
tags: latest
|
|
||||||
dockerfile: Dockerfile
|
|
||||||
context: .
|
|
||||||
username:
|
|
||||||
from_secret: dockerhub-username
|
|
||||||
password:
|
|
||||||
from_secret: dockerhub-password
|
|
||||||
platforms:
|
|
||||||
- linux/amd64
|
|
||||||
- linux/arm64
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
# Build stage
|
|
||||||
FROM docker.io/library/golang:1.26-alpine AS builder
|
|
||||||
|
|
||||||
WORKDIR /build
|
|
||||||
COPY go.mod go.sum ./
|
|
||||||
RUN go mod download
|
|
||||||
|
|
||||||
COPY . .
|
|
||||||
RUN go build -o network-go -ldflags="-s -w" .
|
|
||||||
|
|
||||||
# Runtime stage
|
|
||||||
FROM docker.io/library/alpine:latest
|
|
||||||
|
|
||||||
RUN apk add --update --no-cache \
|
|
||||||
iptables \
|
|
||||||
iptables-legacy \
|
|
||||||
ca-certificates \
|
|
||||||
util-linux \
|
|
||||||
nsenter \
|
|
||||||
&& rm -rf /var/cache/apk/*
|
|
||||||
|
|
||||||
COPY --from=builder /build/network-go /usr/local/bin/network-go
|
|
||||||
|
|
||||||
CMD ["/usr/local/bin/network-go"]
|
|
||||||
Reference in New Issue
Block a user