Skip to content

Commit

Permalink
feat: improve dockerfile
Browse files Browse the repository at this point in the history
- Remove build docker file because it was just installing ruby.
- Merge all in one dockerfile

Signed-off-by: jcriadomarco <jcriadomarco@vmware.com>
  • Loading branch information
javiercri committed Jun 9, 2023
2 parents 8666c4b + 7f0d822 commit ab60801
Show file tree
Hide file tree
Showing 7 changed files with 1,926 additions and 101 deletions.
35 changes: 18 additions & 17 deletions base-image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,16 @@
# SPDX-License-Identifier: BSD-2-Clause
# Similar to https://github.com/drecom/docker-centos-ruby/blob/2.6.5-slim/Dockerfile

FROM photon:3.0
FROM photon:4.0

ARG RVM_PATH=/usr/local/rvm
ARG RUBY_VERSION=ruby-3.1.4
ARG RUBY_PATH=/usr/local/rvm/rubies/$RUBY_VERSION
ARG RUBYOPT='-W:no-deprecated -W:no-experimental'

RUN tdnf clean all && \
tdnf upgrade -y && \
tdnf erase -y toybox && \
tdnf install -y \
findutils \
procps-ng \
util-linux \
systemd \
net-tools \
gpg && \
buildDeps="\
ENV PATH $RUBY_PATH/bin:$PATH
ENV FLUENTD_DISABLE_BUNDLER_INJECTION 1
ENV BUILDDEPS="\
gmp-devel \
libffi-devel \
bzip2 \
Expand All @@ -39,8 +31,19 @@ RUN tdnf clean all && \
libedit-devel \
gdbm \
gdbm-devel \
openssl-devel" && \
tdnf install -y $buildDeps && \
openssl-devel"

RUN tdnf clean all && \
tdnf upgrade -y && \
tdnf erase -y toybox && \
tdnf install -y \
findutils \
procps-ng \
util-linux \
systemd \
net-tools \
gpg && \
tdnf install -y $BUILDDEPS && \
tdnf clean all

SHELL [ "/bin/bash", "-l", "-c" ]
Expand All @@ -58,8 +61,6 @@ RUN curl -sSL https://rvm.io/mpapis.asc | gpg --import \
&& gem update --system --no-document \
&& gem install bundler -v '>= 2.4.13' --default --no-document

ENV FLUENTD_DISABLE_BUNDLER_INJECTION 1

## Install dependencies which are not up to date and we need a fork or local download
RUN mkdir -p /fluentd/log /fluentd/etc /fluentd/plugins /usr/local/bundle/bin/ \
&& wget https://raw.githubusercontent.com/fluent/fluentd-kubernetes-daemonset/master/docker-image/v1.15/debian-elasticsearch7/plugins/parser_kubernetes.rb -P /fluentd/plugins \
Expand Down Expand Up @@ -97,7 +98,7 @@ ENV LD_PRELOAD="/usr/lib/libjemalloc.so"
RUN cd /fluentd \
&& gem sources --clear-all \
&& ln -s $(which fluentd) /usr/local/bundle/bin/fluentd \
&& tdnf remove -y $buildDeps \
&& tdnf remove -y $BUILDDEPS \
&& tdnf clean all \
&& gem uninstall bundler \
&& gem cleanup \
Expand Down
11 changes: 6 additions & 5 deletions base-image/Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
source "https://rubygems.org"

# pin fluentd, probably a good idea to pin all gems
gem "fluentd", "1.15.3"
gem "fluentd", "1.16.1"

gem 'oj', '3.13.23'
gem 'ffi'
Expand All @@ -10,15 +10,15 @@ gem 'fluent-plugin-azure-loganalytics', "0.7.0"
gem 'fluent-plugin-cloudwatch-logs', "0.14.3"
gem 'fluent-plugin-concat', "2.5.0"
gem 'fluent-plugin-datadog', "0.14.2"
gem 'fluent-plugin-elasticsearch', "5.2.4"
gem 'fluent-plugin-opensearch', "1.0.9"
gem 'fluent-plugin-elasticsearch', "5.3.0"
gem 'fluent-plugin-opensearch', "1.1.0"
gem 'fluent-plugin-gelf-hs', "1.0.8"
gem 'fluent-plugin-grafana-loki', "1.2.20"
gem 'fluent-plugin-grok-parser', "2.6.2"
gem 'fluent-plugin-json-in-json-2', "1.0.2"
gem 'fluent-plugin-kafka', "0.18.1"
gem 'fluent-plugin-kinesis', "3.4.2"
gem 'fluent-plugin-kubernetes_metadata_filter', "2.13.0"
gem 'fluent-plugin-kubernetes_metadata_filter', "3.2.0"
gem 'fluent-plugin-kubernetes_sumologic', "2.4.2"
gem 'fluent-plugin-kubernetes', "0.3.1"
gem 'fluent-plugin-logentries', "0.2.10"
Expand All @@ -28,7 +28,7 @@ gem 'fluent-plugin-mongo', "1.5.0"
gem 'fluent-plugin-multi-format-parser', "1.0.0"
gem 'fluent-plugin-out-http', "1.3.3"
gem 'fluent-plugin-papertrail', "0.2.8"
gem 'fluent-plugin-prometheus', "2.0.2"
gem 'fluent-plugin-prometheus', "2.0.3"
gem 'fluent-plugin-record-modifier', "2.1.0"
gem 'fluent-plugin-record-reformer', "0.9.1"
gem 'fluent-plugin-redis', "0.3.5"
Expand All @@ -51,5 +51,6 @@ gem 'gelf', "3.1.0"
gem 'logfmt', "0.0.10"
gem 'kubeclient', "~> 4.9.3"
gem 'fluent-plugin-webhdfs', '1.5.0'
gem 'fluent-plugin-detect-exceptions', '~> 0.0.15'
# webhdfs requires gssapi plugin to work
gem 'gssapi', '1.3.1'
110 changes: 48 additions & 62 deletions base-image/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ GEM
amq-protocol (2.3.2)
attr_required (1.0.1)
aws-eventstream (1.2.0)
aws-partitions (1.668.0)
aws-partitions (1.777.0)
aws-sdk-cloudwatchlogs (1.57.0)
aws-sdk-core (~> 3, >= 3.165.0)
aws-sigv4 (~> 1.1)
aws-sdk-core (3.168.2)
aws-sdk-core (3.174.0)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.5)
Expand Down Expand Up @@ -66,35 +66,19 @@ GEM
elasticsearch-api (= 8.5.2)
elasticsearch-api (8.5.2)
multi_json
excon (0.94.0)
faraday (1.10.2)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
faraday-excon (~> 1.1)
faraday-httpclient (~> 1.0)
faraday-multipart (~> 1.0)
faraday-net_http (~> 1.0)
faraday-net_http_persistent (~> 1.0)
faraday-patron (~> 1.0)
faraday-rack (~> 1.0)
faraday-retry (~> 1.0)
excon (0.100.0)
faraday (2.7.6)
faraday-net_http (>= 2.0, < 3.1)
ruby2_keywords (>= 0.0.4)
faraday-em_http (1.0.0)
faraday-em_synchrony (1.0.0)
faraday-excon (1.1.0)
faraday-httpclient (1.0.1)
faraday-multipart (1.0.4)
multipart-post (~> 2)
faraday-net_http (1.0.1)
faraday-net_http_persistent (1.2.0)
faraday-patron (1.0.0)
faraday-rack (1.0.0)
faraday-retry (1.0.3)
faraday_middleware (1.2.0)
faraday (~> 1.0)
faraday_middleware-aws-sigv4 (0.6.1)
faraday-excon (2.1.0)
excon (>= 0.27.4)
faraday (~> 2.0)
faraday-follow_redirects (0.3.0)
faraday (>= 1, < 3)
faraday-net_http (3.0.2)
faraday_middleware-aws-sigv4 (1.0.1)
aws-sigv4 (~> 1.0)
faraday (>= 1.8, < 2)
faraday (>= 2.0, < 3)
ffi (1.15.5)
ffi-compiler (1.0.1)
ffi (>= 1.0.0)
Expand All @@ -120,10 +104,13 @@ GEM
fluent-plugin-datadog (0.14.2)
fluentd (>= 1, < 2)
net-http-persistent (~> 4.0.1)
fluent-plugin-elasticsearch (5.2.4)
fluent-plugin-detect-exceptions (0.0.15)
fluentd (>= 0.10)
fluent-plugin-elasticsearch (5.3.0)
elasticsearch
excon
faraday (~> 1.10)
faraday (>= 2.0.0)
faraday-excon (>= 2.0.0)
fluentd (>= 0.14.22)
fluent-plugin-gelf-hs (1.0.8)
fluentd
Expand All @@ -147,8 +134,8 @@ GEM
fluent-plugin-kubernetes (0.3.1)
docker-api
fluentd
fluent-plugin-kubernetes_metadata_filter (2.13.0)
fluentd (>= 0.14.0, < 1.16)
fluent-plugin-kubernetes_metadata_filter (3.2.0)
fluentd (>= 0.14.0, < 1.17)
kubeclient (>= 4.0.0, < 5.0.0)
lru_redux
fluent-plugin-kubernetes_sumologic (2.4.2)
Expand All @@ -168,11 +155,12 @@ GEM
fluent-plugin-mysqlslowquery (0.0.9)
fluentd (>= 0.12.0, < 2)
myslog (~> 0.0)
fluent-plugin-opensearch (1.0.9)
fluent-plugin-opensearch (1.1.0)
aws-sdk-core (~> 3)
excon
faraday (~> 1.10)
faraday_middleware-aws-sigv4
faraday (>= 2.0.0)
faraday-excon (>= 2.0.0)
faraday_middleware-aws-sigv4 (~> 1.0.1)
fluentd (>= 0.14.22)
opensearch-ruby
fluent-plugin-out-http (1.3.3)
Expand All @@ -181,7 +169,7 @@ GEM
fluent-plugin-papertrail (0.2.8)
fluent-mixin-config-placeholders (~> 0.4.0)
fluentd (>= 0.10, < 2)
fluent-plugin-prometheus (2.0.2)
fluent-plugin-prometheus (2.0.3)
fluentd (>= 1.9.1, < 2)
prometheus-client (>= 2.1.0)
fluent-plugin-record-modifier (2.1.0)
Expand Down Expand Up @@ -239,23 +227,21 @@ GEM
fluent-plugin-webhdfs (1.5.0)
fluentd (>= 0.14.22)
webhdfs (>= 0.10.0)
fluentd (1.15.3)
fluentd (1.16.1)
bundler
cool.io (>= 1.4.5, < 2.0.0)
http_parser.rb (>= 0.5.1, < 0.9.0)
msgpack (>= 1.3.1, < 2.0.0)
serverengine (>= 2.3.0, < 3.0.0)
serverengine (>= 2.3.2, < 3.0.0)
sigdump (~> 0.2.2)
strptime (>= 0.2.4, < 1.0.0)
tzinfo (>= 1.0, < 3.0)
tzinfo-data (~> 1.0)
webrick (>= 1.4.2, < 1.8.0)
webrick (~> 1.4)
yajl-ruby (~> 1.0)
gelf (3.1.0)
json
google-protobuf (3.21.9)
google-protobuf (3.21.9-x86_64-darwin)
google-protobuf (3.21.9-x86_64-linux)
gssapi (1.3.1)
ffi (>= 1.0.1)
http (4.4.1)
Expand Down Expand Up @@ -299,9 +285,8 @@ GEM
minitest (5.18.0)
mongo (2.6.4)
bson (>= 4.3.0, < 5.0.0)
msgpack (1.6.0)
msgpack (1.7.1)
multi_json (1.15.0)
multipart-post (2.2.3)
myslog (0.1.1)
net-http-persistent (4.0.1)
connection_pool (~> 2.2)
Expand All @@ -317,12 +302,12 @@ GEM
validate_email
validate_url
webfinger (>= 1.0.1)
opensearch-api (2.0.2)
opensearch-api (2.2.0)
multi_json
opensearch-ruby (2.0.3)
opensearch-api (= 2.0.2)
opensearch-transport (~> 2.0.0)
opensearch-transport (2.0.1)
opensearch-ruby (2.1.0)
opensearch-api (~> 2.1)
opensearch-transport (~> 2.0)
opensearch-transport (2.1.0)
faraday (>= 1.0, < 3)
multi_json
prometheus-client (4.0.0)
Expand All @@ -348,7 +333,7 @@ GEM
ruby-kafka (1.5.0)
digest-crc
ruby2_keywords (0.0.5)
serverengine (2.3.0)
serverengine (2.3.2)
sigdump (~> 0.2.2)
set (1.0.3)
sigdump (0.2.4)
Expand All @@ -365,7 +350,7 @@ GEM
ffi (~> 1.9)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
tzinfo-data (1.2022.7)
tzinfo-data (1.2023.3)
tzinfo (>= 1.0.0)
unf (0.1.4)
unf_ext
Expand All @@ -378,13 +363,13 @@ GEM
activemodel (>= 3.0.0)
public_suffix
vertica (1.0.3)
webfinger (2.0.0)
webfinger (2.1.2)
activesupport
faraday (~> 1.7)
faraday_middleware (~> 1.1)
faraday (~> 2.0)
faraday-follow_redirects
webhdfs (0.10.2)
addressable
webrick (1.7.0)
webrick (1.8.1)
yajl-ruby (1.4.3)

PLATFORMS
Expand All @@ -399,26 +384,27 @@ DEPENDENCIES
fluent-plugin-cloudwatch-logs (= 0.14.3)
fluent-plugin-concat (= 2.5.0)
fluent-plugin-datadog (= 0.14.2)
fluent-plugin-elasticsearch (= 5.2.4)
fluent-plugin-detect-exceptions (~> 0.0.15)
fluent-plugin-elasticsearch (= 5.3.0)
fluent-plugin-gelf-hs (= 1.0.8)
fluent-plugin-grafana-loki (= 1.2.20)
fluent-plugin-grok-parser (= 2.6.2)
fluent-plugin-json-in-json-2 (= 1.0.2)
fluent-plugin-kafka (= 0.18.1)
fluent-plugin-kinesis (= 3.4.2)
fluent-plugin-kubernetes (= 0.3.1)
fluent-plugin-kubernetes_metadata_filter (= 2.13.0)
fluent-plugin-kubernetes_metadata_filter (= 3.2.0)
fluent-plugin-kubernetes_sumologic (= 2.4.2)
fluent-plugin-logentries (= 0.2.10)
fluent-plugin-logzio (= 0.0.22)
fluent-plugin-mail (= 0.3.0)
fluent-plugin-mongo (= 1.5.0)
fluent-plugin-multi-format-parser (= 1.0.0)
fluent-plugin-mysqlslowquery (= 0.0.9)
fluent-plugin-opensearch (= 1.0.9)
fluent-plugin-opensearch (= 1.1.0)
fluent-plugin-out-http (= 1.3.3)
fluent-plugin-papertrail (= 0.2.8)
fluent-plugin-prometheus (= 2.0.2)
fluent-plugin-prometheus (= 2.0.3)
fluent-plugin-record-modifier (= 2.1.0)
fluent-plugin-record-reformer (= 0.9.1)
fluent-plugin-redis (= 0.3.5)
Expand All @@ -434,14 +420,14 @@ DEPENDENCIES
fluent-plugin-uri-parser (= 0.3.0)
fluent-plugin-verticajson (= 0.0.6)
fluent-plugin-vmware-log-intelligence (= 2.0.6)
fluent-plugin-vmware-loginsight (= 1.3.1)
fluent-plugin-vmware-loginsight (= 1.4.1)
fluent-plugin-webhdfs (= 1.5.0)
fluentd (= 1.15.3)
fluentd (= 1.16.1)
gelf (= 3.1.0)
gssapi (= 1.3.1)
kubeclient (~> 4.9.3)
logfmt (= 0.0.10)
oj (= 3.13.23)

BUNDLED WITH
2.1.4
2.4.13
Loading

0 comments on commit ab60801

Please sign in to comment.