Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multistage build (enhancement) #447

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Repo config
.git

# IDE configs
.vscode
.idea

# Environment variables
.env

# Other
website
grafana
integration_test
prometheus
6 changes: 3 additions & 3 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ dockers:
- image_templates:
- '{{ if .IsSnapshot }}ghcr.io/{{ end }}ecadlabs/signatory:{{ if .IsSnapshot }}{{ .FullCommit }}{{ else }}{{ .Tag }}{{ end }}-amd64'
- '{{ if not .IsSnapshot }}ecadlabs/signatory:latest-amd64{{ end }}'
dockerfile: Dockerfile
dockerfile: goreleaser.dockerfile
use: buildx
build_flag_templates:
- "--pull"
Expand All @@ -256,7 +256,7 @@ dockers:
- image_templates:
- '{{ if .IsSnapshot }}ghcr.io/{{ end }}ecadlabs/signatory:{{ if .IsSnapshot }}{{ .FullCommit }}{{ else }}{{ .Tag }}{{ end }}-arm64'
- '{{ if not .IsSnapshot }}ecadlabs/signatory:latest-arm64{{ end }}'
dockerfile: Dockerfile
dockerfile: goreleaser.dockerfile
use: buildx
build_flag_templates:
- "--pull"
Expand All @@ -270,7 +270,7 @@ dockers:
- image_templates:
- '{{ if .IsSnapshot }}ghcr.io/{{ end }}ecadlabs/signatory:{{ if .IsSnapshot }}{{ .FullCommit }}{{ else }}{{ .Tag }}{{ end }}-armv7'
- '{{ if not .IsSnapshot }}ecadlabs/signatory:latest-armv7{{ end }}'
dockerfile: Dockerfile
dockerfile: goreleaser.dockerfile
use: buildx
build_flag_templates:
- "--pull"
Expand Down
23 changes: 15 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
FROM ubuntu:22.04
RUN apt-get update
RUN apt-get install -y curl apt-transport-https
RUN apt-get clean
FROM golang:1.21-bullseye AS builder
RUN apt-get update && apt-get install
ADD . /signatory
WORKDIR /signatory
RUN make

COPY ./signatory /bin
COPY ./signatory-cli /bin

ENTRYPOINT ["/bin/signatory"]
FROM debian:buster-slim
WORKDIR /signatory
RUN apt update -y \
&& apt install -y curl apt-transport-https\
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /signatory/signatory.yaml /signatory/signatory.yaml
COPY --from=builder /signatory/signatory /usr/bin/signatory
COPY --from=builder /signatory/signatory-cli /usr/bin/signatory-cli

ENTRYPOINT ["/usr/bin/signatory"]
CMD [ "-c", "/signatory/signatory.yaml" ]
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ signatory-cli:

.PHONY: container
container: signatory signatory-cli
docker build -t ecadlabs/signatory:$(CONTAINER_TAG) .
docker build -t ecadlabs/signatory:$(CONTAINER_TAG) -f goreleaser.dockerfile .

clean:
rm signatory signatory-cli
Expand Down
9 changes: 9 additions & 0 deletions goreleaser.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM ubuntu:22.04
RUN apt-get update
RUN apt-get install -y curl apt-transport-https
RUN apt-get clean

COPY ./signatory /bin
COPY ./signatory-cli /bin

ENTRYPOINT ["/bin/signatory"]