add dockerfile and CI pipeline

This commit is contained in:
Adora Laura Kalb 2023-04-25 21:44:47 +02:00
parent 812a4b6195
commit 32e06a0244
Signed by: adoralaura
GPG key ID: 7A4552166FC8C056
2 changed files with 45 additions and 0 deletions

View file

@ -0,0 +1,16 @@
when:
event:
- push
pipeline:
docker-deploy-push:
image: woodpeckerci/plugin-docker-buildx
settings:
dockerfile: Dockerfile
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le
repo: codeberg.org/lauralani/go-urlsh
registry: codeberg.org
tags: latest
username: lauralani
password:
from_secret: codeberg_token

29
Dockerfile Normal file
View file

@ -0,0 +1,29 @@
FROM golang:1.20-alpine AS dev
COPY . /var/app
WORKDIR /var/app
ENV GO111MODULE="on" \
CGO_ENABLED=0 \
GOOS=linux
EXPOSE 80
ENTRYPOINT ["sh"]
FROM dev as build
RUN go mod download && go mod verify
RUN go build -o go-urlsh main.go
RUN chmod +x go-urlsh
FROM scratch AS prod
WORKDIR /var/app
COPY --from=build /var/app/go-urlsh /var/app/
COPY --from=build /var/app/web /var/app/web
EXPOSE 80
ENTRYPOINT ["/var/app/go-urlsh"]
CMD ""