Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d1a3b01

Browse files
committedApr 4, 2025·
updates to docker image template based on feedback
* change base images to ubi9-minimal * do all env2yaml related copying in 1 COPY * use -trimpath in go build * move other COPY to end of dockerfile * don't run package manager upgrade
1 parent eeb2162 commit d1a3b01

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed
 

‎docker/templates/Dockerfile.erb

+13-16
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<% license = 'Elastic License' -%>
1414
<% end -%>
1515
<% if image_flavor == 'full' || image_flavor == 'oss' -%>
16-
<% base_image = 'docker.elastic.co/ubi9/ubi-minimal' -%>
16+
<% base_image = 'redhat/ubi9-minimal:latest' -%>
1717
<% go_image = 'golang:1.23' -%>
1818
<% package_manager = 'microdnf' -%>
1919
<% else -%>
@@ -26,13 +26,11 @@
2626
# Build env2yaml
2727
FROM <%= go_image %> as builder-env2yaml
2828

29-
COPY env2yaml/env2yaml.go /tmp/go/src/env2yaml/env2yaml.go
30-
COPY env2yaml/go.mod /tmp/go/src/env2yaml/go.mod
31-
COPY env2yaml/go.sum /tmp/go/src/env2yaml/go.sum
29+
COPY env2yaml/env2yaml.go env2yaml/go.mod env2yaml/go.sum /tmp/go/src/env2yaml/
3230

3331
WORKDIR /tmp/go/src/env2yaml
3432

35-
RUN go build
33+
RUN go build -trimpath
3634

3735
# Build main image
3836
# Minimal distributions do not ship with en language packs.
@@ -44,21 +42,10 @@ ENV LANG=<%= locale %> LC_ALL=<%= locale %>
4442

4543
WORKDIR /usr/share
4644

47-
COPY --from=builder-env2yaml /tmp/go/src/env2yaml/env2yaml /usr/local/bin/env2yaml
48-
COPY config/pipelines.yml config/log4j2.properties config/log4j2.file.properties config/
49-
<% if image_flavor == 'oss' -%>
50-
COPY config/logstash-oss.yml config/logstash.yml
51-
<% else -%><%# 'full', 'wolfi' -%>
52-
COPY config/logstash-full.yml config/logstash.yml
53-
<% end -%>
54-
COPY pipeline/default.conf pipeline/logstash.conf
55-
COPY bin/docker-entrypoint /usr/local/bin/
56-
5745
# Install packages
5846
RUN for iter in {1..10}; do \
5947
<% if image_flavor == 'full' || image_flavor == 'oss' -%>
6048
<%= package_manager %> update -y && \
61-
<%= package_manager %> upgrade -y && \
6249
<%= package_manager %> install -y procps findutils tar gzip && \
6350
<%= package_manager %> install -y openssl && \
6451
<%= package_manager %> install -y which shadow-utils && \
@@ -105,6 +92,16 @@ RUN addgroup -g 1000 logstash && \
10592
chmod 0755 /usr/local/bin/docker-entrypoint && \
10693
rmdir config
10794

95+
COPY --from=builder-env2yaml /tmp/go/src/env2yaml/env2yaml /usr/local/bin/env2yaml
96+
COPY config/pipelines.yml config/log4j2.properties config/log4j2.file.properties config/
97+
<% if image_flavor == 'oss' -%>
98+
COPY config/logstash-oss.yml config/logstash.yml
99+
<% else -%><%# 'full', 'wolfi' -%>
100+
COPY config/logstash-full.yml config/logstash.yml
101+
<% end -%>
102+
COPY pipeline/default.conf pipeline/logstash.conf
103+
COPY bin/docker-entrypoint /usr/local/bin/
104+
108105
WORKDIR /usr/share/logstash
109106

110107
USER 1000

0 commit comments

Comments
 (0)
Please sign in to comment.