mirror of
https://github.com/elastic/logstash.git
synced 2025-06-28 09:46:03 -04:00
introduce go.mod for env2yaml (#15921)
Update the env2yaml to have a go.mod instead of relying on disabling go modules, otherwise building with golang 1.22 will fail in the future. This change also directly uses the golang image to build the binary removing the need for an intermediate image.
This commit is contained in:
parent
db193f56c4
commit
5c3e64d591
4 changed files with 12 additions and 12 deletions
|
@ -200,16 +200,12 @@ venv: requirements.txt
|
|||
for i in 0 1 2 3 4 5; do sleep "$i"; pip install -r requirements.txt && break; done &&\
|
||||
touch venv
|
||||
|
||||
# Make a Golang container that can compile our env2yaml tool.
|
||||
golang:
|
||||
docker build -t golang:env2yaml data/golang
|
||||
|
||||
# Compile "env2yaml", the helper for configuring logstash.yml via environment
|
||||
# variables.
|
||||
env2yaml: golang
|
||||
docker run --rm -i \
|
||||
-v $(PWD)/data/logstash/env2yaml:/usr/local/src/env2yaml:Z \
|
||||
golang:env2yaml
|
||||
env2yaml:
|
||||
docker run --rm \
|
||||
-v "$(PWD)/data/logstash/env2yaml:/usr/src/env2yaml" \
|
||||
-w /usr/src/env2yaml golang:1 go build
|
||||
|
||||
# Generate the Dockerfiles from Jinja2 templates.
|
||||
dockerfile: venv templates/Dockerfile.j2
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
FROM golang:1
|
||||
RUN go env -w GO111MODULE=off && (for i in 0 1 2 3 4 5; do sleep "$i"; go get gopkg.in/yaml.v2 && break; done)
|
||||
WORKDIR /usr/local/src/env2yaml
|
||||
CMD ["go", "build"]
|
5
docker/data/logstash/env2yaml/go.mod
Normal file
5
docker/data/logstash/env2yaml/go.mod
Normal file
|
@ -0,0 +1,5 @@
|
|||
module logstash/env2yaml
|
||||
|
||||
go 1.21
|
||||
|
||||
require gopkg.in/yaml.v2 v2.4.0
|
3
docker/data/logstash/env2yaml/go.sum
Normal file
3
docker/data/logstash/env2yaml/go.sum
Normal file
|
@ -0,0 +1,3 @@
|
|||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
Loading…
Add table
Add a link
Reference in a new issue