diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..224bbecd --- /dev/null +++ b/.dockerignore @@ -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 diff --git a/.goreleaser.yml b/.goreleaser.yml index fafee98b..2371e35a 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -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" @@ -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" @@ -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" diff --git a/Dockerfile b/Dockerfile index 23234a2e..22b6d350 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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" ] diff --git a/Makefile b/Makefile index db9ff86a..e90d8992 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/goreleaser.dockerfile b/goreleaser.dockerfile new file mode 100644 index 00000000..d7709c73 --- /dev/null +++ b/goreleaser.dockerfile @@ -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"] \ No newline at end of file