diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9ae8e4b..e16a575 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,6 +12,7 @@ jobs: image: - reactphp # Jan 2020 - nodejs # Feb 2020 + - go # Mar 2020 runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 @@ -27,6 +28,7 @@ jobs: - random # Random image every time this workflow is executed - reactphp # Jan 2020 - nodejs # Feb 2020 + - go # Mar 2020 needs: - lint-dockerfile runs-on: ubuntu-latest @@ -48,6 +50,7 @@ jobs: - random # Random image every time this workflow is executed - reactphp # Jan 2020 - nodejs # Feb 2020 + - go # Mar 2020 needs: build-docker-image runs-on: ubuntu-latest steps: @@ -76,6 +79,7 @@ jobs: - random # Random image every time this workflow is executed - reactphp # Jan 2020 - nodejs # Feb 2020 + - go # Mar 2020 rules: [customHosts, nonWwwToWww, wwwToNonWww] runs-on: ubuntu-latest steps: @@ -135,6 +139,7 @@ jobs: - random # Random image every time this workflow is executed - reactphp # Jan 2020 - nodejs # Feb 2020 + - go # Mar 2020 needs: tests runs-on: ubuntu-latest steps: diff --git a/README.md b/README.md index fb8aa1c..4482189 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() { +}