mirror of
https://github.com/itzg/mc-router.git
synced 2024-11-24 11:55:24 +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:
|
dockers:
|
||||||
- image_templates:
|
- image_templates:
|
||||||
- "itzg/{{ .ProjectName }}:{{ .Version }}-amd64"
|
- "itzg/{{ .ProjectName }}:{{ .Version }}-amd64"
|
||||||
|
dockerfile: Dockerfile.release
|
||||||
goarch: amd64
|
goarch: amd64
|
||||||
build_flag_templates:
|
build_flag_templates:
|
||||||
- --platform
|
- --platform
|
||||||
@ -53,6 +54,7 @@ dockers:
|
|||||||
|
|
||||||
- image_templates:
|
- image_templates:
|
||||||
- "itzg/{{ .ProjectName }}:{{ .Version }}-arm64"
|
- "itzg/{{ .ProjectName }}:{{ .Version }}-arm64"
|
||||||
|
dockerfile: Dockerfile.release
|
||||||
goarch: arm64
|
goarch: arm64
|
||||||
build_flag_templates:
|
build_flag_templates:
|
||||||
- --platform
|
- --platform
|
||||||
@ -62,6 +64,7 @@ dockers:
|
|||||||
- --label=org.opencontainers.image.revision={{ .FullCommit }}
|
- --label=org.opencontainers.image.revision={{ .FullCommit }}
|
||||||
- image_templates:
|
- image_templates:
|
||||||
- "itzg/{{ .ProjectName }}:{{ .Version }}-arm32v6"
|
- "itzg/{{ .ProjectName }}:{{ .Version }}-arm32v6"
|
||||||
|
dockerfile: Dockerfile.release
|
||||||
goarch: arm
|
goarch: arm
|
||||||
goarm: "6"
|
goarm: "6"
|
||||||
build_flag_templates:
|
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
|
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"]
|
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
|
## Building locally with Docker
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker run -it --rm \
|
docker build -t mc-router .
|
||||||
-v gopkg:/go/pkg \
|
|
||||||
-v ${PWD}:/build -w /build \
|
|
||||||
golang:1.17.3 \
|
|
||||||
go build ./cmd/mc-router
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Skaffold
|
## Skaffold
|
||||||
|
Loading…
Reference in New Issue
Block a user