Created
March 3, 2020 19:12
-
-
Save emmiep/446ad80462d0881f68d2f02f95dde837 to your computer and use it in GitHub Desktop.
Caddy cross-platform Docker build
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM --platform=${BUILDPLATFORM} golang:1.14 AS build | |
ARG TARGETOS | |
ARG TARGETARCH | |
ARG caddy_version=v1.0.4 | |
ENV GOOS=${TARGETOS} | |
ENV GOARCH=${TARGETARCH} | |
WORKDIR /usr/local/src/caddy | |
COPY ./main.go ./ | |
RUN go mod init caddy && \ | |
go get github.com/caddyserver/caddy@${caddy_version} && \ | |
go build | |
FROM busybox:1.31-glibc | |
COPY --from=build /usr/local/src/caddy/caddy /usr/local/bin/caddy | |
CMD ["/usr/local/bin/caddy"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"github.com/caddyserver/caddy/caddy/caddymain" | |
) | |
func main() { | |
caddymain.Run() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment