add dockerfile and CI pipeline
This commit is contained in:
parent
812a4b6195
commit
32e06a0244
2 changed files with 45 additions and 0 deletions
16
.woodpecker/deploy-docker.yml
Normal file
16
.woodpecker/deploy-docker.yml
Normal 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
29
Dockerfile
Normal 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 ""
|
Loading…
Reference in a new issue