diff --git a/README.md b/README.md index 8b89685..9d8fce0 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,7 @@ ensure the same behavior across languages. * `random` - Each time when the images are build a random image is selected and build. * `reactphp` - Using [ReactPHP](https://reactphp.org/) (January 2020) * `nodejs` - Using [NodeJS](https://nodejs.org/en/) (February 2020) +* `go` - Using [Go](https://nodejs.org/en/) (March 2020) ## Configuration diff --git a/images/go/Dockerfile b/images/go/Dockerfile new file mode 100644 index 0000000..c9cff98 --- /dev/null +++ b/images/go/Dockerfile @@ -0,0 +1,23 @@ +FROM golang:1.14-alpine3.11 AS build + +RUN mkdir /opt/app +WORKDIR /opt/app + +COPY app.go /opt/app + +# hadolint ignore=DL3018,DL3019 +RUN apk add git gcc musl-dev godep + +ENV GOBIN /go/bin +ENV GO111MODULE on + +WORKDIR /go + +RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -ldflags '-w' -o /app /opt/app/app.go + +### App +FROM scratch AS app + +COPY --from=build /app /app + +ENTRYPOINT ["/app"] diff --git a/images/go/app.go b/images/go/app.go new file mode 100644 index 0000000..da29a2c --- /dev/null +++ b/images/go/app.go @@ -0,0 +1,4 @@ +package main + +func main() { +}