Signed-off-by: Odyssey <odyssey346@disroot.org>
This commit is contained in:
Odyssey
2022-12-03 20:06:40 +01:00
parent 3cf5032bc9
commit 25f57eb109
2 changed files with 93 additions and 7 deletions
+72
View File
@@ -0,0 +1,72 @@
pipeline:
dockerize:
when:
branch: [main, master]
event: [push]
image: woodpeckerci/plugin-docker-buildx
settings:
dockerfile: Dockerfile
registry: https://codeberg.org/v2
repo: codeberg.org/gothub/gothub
platforms: linux/amd64,linux/arm64
tag: latest
username:
from_secret: user
password:
from_secret: passwd
secrets: [user, passwd]
#dockerize-arm64:
# environment:
# - GOOS=linux
# - GOARCH=arm64
# when:
# branch: [main, master]
# event: [push]
# image: plugins/docker
# settings:
# registry: codeberg.org
# repo: codeberg.org/gothub/gothub
# username:
# from_secret: user
# password:
# from_secret: passwd
# # password = key or actual password
# tags: arm64
dockerize-dev:
when:
event: [push]
branch: [dev]
image: woodpeckerci/plugin-docker-buildx
settings:
dockerfile: Dockerfile
registry: https://codeberg.org/v2
repo: codeberg.org/gothub/gothub
platforms: linux/amd64,linux/arm64
tag: dev
username:
from_secret: user
password:
from_secret: passwd
secrets: [user, passwd]
#dockerize-dev-arm64:
# environment:
# - ARCH=
# - GOOS=linux
# - GOARCH=arm64
# when:
# event: [push]
# branch: [dev]
# image: plugins/docker
# settings:
# registry: codeberg.org
# repo: codeberg.org/gothub/gothub
# username:
# from_secret: user
# password:
# from_secret: passwd
# # password = key or actual password
# tags: ${CI_COMMIT_SHA:0:8}-arm64
# dockerfile: Dockerfile-arm64
# # You can thank the drone docker maintainer for not providing a buildx option.
+21 -7
View File
@@ -1,7 +1,21 @@
FROM alpine:latest
WORKDIR /gothub
COPY ./gothub .
COPY ./public/ ./public/
COPY ./views/ ./views/
CMD ["/bin/sh", "-c", "./gothub", "serve"]
EXPOSE 3000
FROM --platform=$BUILDPLATFORM golang:alpine AS build
ARG TARGETARCH
WORKDIR /src
RUN apk --no-cache add git
RUN git clone https://codeberg.org/gothub/gothub .
RUN go mod download
RUN GOOS=linux GOARCH=$TARGETARCH go build -ldflags "-X codeberg.org/gothub/gothub/pages.Version=$(git rev-parse --short HEAD)" -o /src/gothub
FROM scratch as bin
WORKDIR /app
COPY --from=build /src/gothub .
COPY --from=build /src/views ./views
COPY --from=build /src/public ./public
EXPOSE 3000
CMD ["/app/gothub", "serve"]