From a3c2d17c69b7fcc9058459cb1001f58a867de48f Mon Sep 17 00:00:00 2001 From: Matthew Rich Date: Wed, 9 Oct 2024 23:20:20 +0000 Subject: [PATCH] add docker image build --- build/docker/container-image-build.jx.yaml | 16 ++++++++ build/docker/golang/build/alpine.jx.yaml | 32 +++++++++++++++ build/docker/golang/build/common.jx.yaml | 45 ++++++++++++++++++++++ cli_test.go | 3 +- 4 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 build/docker/container-image-build.jx.yaml create mode 100644 build/docker/golang/build/alpine.jx.yaml create mode 100644 build/docker/golang/build/common.jx.yaml diff --git a/build/docker/container-image-build.jx.yaml b/build/docker/container-image-build.jx.yaml new file mode 100644 index 0000000..728d257 --- /dev/null +++ b/build/docker/container-image-build.jx.yaml @@ -0,0 +1,16 @@ +--- +imports: +- /etc/jx/dockerhub.jx.yaml +resources: +- type: container-image + config: dockerhub + transition: update + attributes: + name: rosskeenhouse/build-golang:1.22.6-alpine + push: true + dockerfile: |- + FROM golang:1.22.6-alpine + COPY . /opt/build + WORKDIR /opt/build + RUN ./jx apply ./alpine.jx.yaml + contextref: file://build/docker/golang/build diff --git a/build/docker/golang/build/alpine.jx.yaml b/build/docker/golang/build/alpine.jx.yaml new file mode 100644 index 0000000..c8e5bad --- /dev/null +++ b/build/docker/golang/build/alpine.jx.yaml @@ -0,0 +1,32 @@ +imports: +- file://common.jx.yaml +resources: +- type: package + transition: create + attributes: + name: musl-dev +- type: package + transition: create + attributes: + name: luajit + verion: =~2.2 +- type: package + transition: create + attributes: + name: luajit-dev +- type: package + transition: create + attributes: + name: protobuf +- type: package + transition: create + attributes: + name: openjdk8 +- type: package + transition: create + attributes: + name: docker +- type: package + transition: create + attributes: + name: openssh-client diff --git a/build/docker/golang/build/common.jx.yaml b/build/docker/golang/build/common.jx.yaml new file mode 100644 index 0000000..b64c30d --- /dev/null +++ b/build/docker/golang/build/common.jx.yaml @@ -0,0 +1,45 @@ +resources: +- type: file + transition: create + attributes: + path: /usr/local/bin/antlr-4.10-complete.jar + sourceref: https://www.antlr.org/download/antlr-4.10-complete.jar + owner: root + group: root + mode: 0755 +- type: package + transition: create + attributes: + name: make +- type: package + transition: create + attributes: + name: openssl +- type: package + transition: create + attributes: + name: curl +- type: package + transition: create + attributes: + name: git +- type: package + transition: create + attributes: + name: gcc +- type: exec + transition: create + attributes: + create: + path: go + args: + - install + - google.golang.org/protobuf/cmd/protoc-gen-go@latest +- type: exec + transition: create + attributes: + create: + path: go + args: + - install + - golang.org/x/vuln/cmd/govulncheck@latest diff --git a/cli_test.go b/cli_test.go index 7a24759..84ccf3e 100644 --- a/cli_test.go +++ b/cli_test.go @@ -197,7 +197,8 @@ attributes: gecos: "foo user" `) - assert.Nil(t, rw.Write(userdecl)) + _, writeErr := rw.Write(userdecl) + assert.Nil(t, writeErr) })) defer server.Close()