mirror of
https://github.com/itzg/mc-router.git
synced 2024-11-21 11:25:41 +01:00
Added a multi-stage Dockerfile for easier local image builds
This commit is contained in:
parent
1b1f8e5f22
commit
ca55bde751
7
.dockerignore
Normal file
7
.dockerignore
Normal file
@ -0,0 +1,7 @@
|
||||
Dockerfile*
|
||||
.git/**
|
||||
dist/**
|
||||
.goreleaser.yml
|
||||
.github/**
|
||||
docs/**
|
||||
README*
|
@ -43,6 +43,7 @@ snapshot:
|
||||
dockers:
|
||||
- image_templates:
|
||||
- "itzg/{{ .ProjectName }}:{{ .Version }}-amd64"
|
||||
dockerfile: Dockerfile.release
|
||||
goarch: amd64
|
||||
build_flag_templates:
|
||||
- --platform
|
||||
@ -53,6 +54,7 @@ dockers:
|
||||
|
||||
- image_templates:
|
||||
- "itzg/{{ .ProjectName }}:{{ .Version }}-arm64"
|
||||
dockerfile: Dockerfile.release
|
||||
goarch: arm64
|
||||
build_flag_templates:
|
||||
- --platform
|
||||
@ -62,6 +64,7 @@ dockers:
|
||||
- --label=org.opencontainers.image.revision={{ .FullCommit }}
|
||||
- image_templates:
|
||||
- "itzg/{{ .ProjectName }}:{{ .Version }}-arm32v6"
|
||||
dockerfile: Dockerfile.release
|
||||
goarch: arm
|
||||
goarm: "6"
|
||||
build_flag_templates:
|
||||
|
17
Dockerfile
17
Dockerfile
@ -1,8 +1,13 @@
|
||||
FROM golang:1.17 as builder
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
COPY . .
|
||||
RUN CGO_ENABLED=0 go build ./cmd/mc-router
|
||||
|
||||
FROM scratch
|
||||
|
||||
LABEL org.opencontainers.image.authors="Geoff Bourne <itzgeoff@gmail.com>"
|
||||
LABEL org.opencontainers.image.title="mc-router"
|
||||
LABEL org.opencontainers.image.source="https://github.com/itzg/mc-router"
|
||||
|
||||
COPY mc-router /
|
||||
ENTRYPOINT ["/mc-router"]
|
||||
COPY --from=builder /build/mc-router /mc-router
|
||||
|
8
Dockerfile.release
Normal file
8
Dockerfile.release
Normal file
@ -0,0 +1,8 @@
|
||||
FROM scratch
|
||||
|
||||
LABEL org.opencontainers.image.authors="Geoff Bourne <itzgeoff@gmail.com>"
|
||||
LABEL org.opencontainers.image.title="mc-router"
|
||||
LABEL org.opencontainers.image.source="https://github.com/itzg/mc-router"
|
||||
|
||||
COPY mc-router /
|
||||
ENTRYPOINT ["/mc-router"]
|
@ -165,11 +165,7 @@ kubectl apply -f https://raw.githubusercontent.com/itzg/mc-router/master/docs/k8
|
||||
## Building locally with Docker
|
||||
|
||||
```bash
|
||||
docker run -it --rm \
|
||||
-v gopkg:/go/pkg \
|
||||
-v ${PWD}:/build -w /build \
|
||||
golang:1.17.3 \
|
||||
go build ./cmd/mc-router
|
||||
docker build -t mc-router .
|
||||
```
|
||||
|
||||
## Skaffold
|
||||
|
Loading…
Reference in New Issue
Block a user