add Docker templates
This commit is contained in:
parent
6f4c7387e8
commit
588b6cc45d
3 changed files with 70 additions and 0 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -24,5 +24,9 @@
|
|||
# Woodpecker CI
|
||||
!.woodpecker/*
|
||||
|
||||
# Docker build files
|
||||
!Dockerfile
|
||||
!Dockerfile.*
|
||||
|
||||
# ...even if they are in subdirectories
|
||||
!*/
|
||||
|
|
35
.woodpecker/deploy-docker.yml
Normal file
35
.woodpecker/deploy-docker.yml
Normal file
|
@ -0,0 +1,35 @@
|
|||
when:
|
||||
- event: [pull_request, tag]
|
||||
|
||||
|
||||
steps:
|
||||
docker-deploy-pr:
|
||||
when:
|
||||
- event: pull_request
|
||||
image: woodpeckerci/plugin-docker-buildx
|
||||
settings:
|
||||
dockerfile: Dockerfile
|
||||
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64
|
||||
repo: adoralaura/adoralaura
|
||||
registry: https://index.docker.io/v1/
|
||||
tag: pr-${CI_COMMIT_PULL_REQUEST}
|
||||
username: adoralaura
|
||||
password:
|
||||
from_secret: dockerhub_token
|
||||
|
||||
|
||||
docker-deploy-tag:
|
||||
when:
|
||||
event: tag
|
||||
image: woodpeckerci/plugin-docker-buildx
|
||||
settings:
|
||||
dockerfile: Dockerfile
|
||||
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64
|
||||
repo: adoralaura/app-name
|
||||
registry: https://index.docker.io/v1/
|
||||
auto_tag: true
|
||||
username: adoralaura
|
||||
password:
|
||||
from_secret: dockerhub_token
|
||||
|
||||
|
31
Dockerfile
Normal file
31
Dockerfile
Normal file
|
@ -0,0 +1,31 @@
|
|||
FROM golang:1.22-bullseye 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 DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends --assume-yes ca-certificates
|
||||
RUN go mod download && go mod verify
|
||||
RUN go build -o app-name main.go
|
||||
RUN chmod +x app-name
|
||||
|
||||
|
||||
FROM gcr.io/distroless/static-debian12 AS prod
|
||||
|
||||
WORKDIR /app
|
||||
COPY --from=build /var/app/app-name /bin/
|
||||
|
||||
LABEL maintainer="Adora Laura Kalb <adora@lila.network>"
|
||||
|
||||
EXPOSE 8080
|
||||
ENTRYPOINT ["/bin/app-name"]
|
Loading…
Reference in a new issue