Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 14 additions & 43 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,23 +71,12 @@ steps:
commands:
- go test ./...

- name: build
image: golang
depends_on:
- wait-for-redis
- code-quality
volumes:
- name: deps
path: /go
commands:
- CGO_ENABLED=0 GOOS=linux go build -o servflow

- name: e2e-tests
image: docker:27.3.1
privileged: true
depends_on:
- wait-for-redis
- build
- code-quality
commands:
- apk add --no-cache bash curl jq python3
- dockerd & # Start the Docker daemon
Expand Down Expand Up @@ -219,36 +208,12 @@ steps:
- cd releases && sha256sum * > checksums.txt && cd ..
- ls -la releases/

- name: docker-build-arm64
- name: docker-build-multiarch
image: docker:27.3.1
privileged: true
depends_on:
- build-linux-arm64
volumes:
- name: docker_cache
path: /var/lib/docker
environment:
DOCKER_BUILDKIT: 1
DOCKER_USERNAME:
from_secret: docker_username
DOCKER_PASSWORD:
from_secret: docker_password
commands:
- export IMAGE_TAG=$(cat .image-tag)
- cp dist/servflow-linux-arm64 servflow
- dockerd &
- sleep 5
- docker info
- docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"
- docker buildx create --use
- docker buildx build --platform linux/arm64 -t $IMAGE_TAG -t servflow/servflow:latest --push .

- name: docker-build-amd64
image: docker:27.3.1
privileged: true
depends_on:
- build-linux-amd64
- docker-build-arm64
- build-gen-tag
- code-quality
volumes:
- name: docker_cache
path: /var/lib/docker
Expand All @@ -260,20 +225,26 @@ steps:
from_secret: docker_password
commands:
- export IMAGE_TAG=$(cat .image-tag)
- cp dist/servflow-linux-amd64 servflow
- export VERSION=$(cat .version)
- dockerd &
- sleep 5
- docker info
- docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"
- docker buildx create --use
- docker buildx build --platform linux/amd64 -t $IMAGE_TAG -t servflow/servflow:latest --push .

- |
if echo "$DRONE_TAG" | grep -iqE '.*-rc[0-9]+$'; then
echo "Release candidate detected, skipping latest tag"
docker buildx build --platform linux/amd64,linux/arm64 --build-arg VERSION=$VERSION -t $IMAGE_TAG --push .
else
echo "Stable release detected, pushing to latest tag"
docker buildx build --platform linux/amd64,linux/arm64 --build-arg VERSION=$VERSION -t $IMAGE_TAG -t servflow/servflow:latest --push .
fi

- name: github-release
image: alpine:latest
depends_on:
- create-archives
- docker-build-amd64
- docker-build-multiarch
environment:
GITHUB_TOKEN:
from_secret: github_token
Expand Down
19 changes: 18 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
# Build stage
FROM golang:1.24 AS builder

ARG TARGETOS
ARG TARGETARCH
ARG VERSION=dev

WORKDIR /app

COPY go.mod go.sum ./

RUN go mod download

COPY . .

RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} CGO_ENABLED=0 go build -ldflags "-X main.version=${VERSION}" -o servflow .

FROM alpine:3.20

WORKDIR /app

COPY servflow servflow
COPY --from=builder /app/servflow servflow

ENV SERVFLOW_PORT=8080
ENV SERVFLOW_LOGLEVEL=production
Expand Down