Skip to content

Commit

Permalink
feat: Join images to a single dockerfile (#416)
Browse files Browse the repository at this point in the history
- join image to a single dockerfile
- remove old meetup files as lots are no longer accurate
- update release process to a single image

Signed-off-by: Brian Davis <dbrian@vmware.com>
  • Loading branch information
slimm609 authored Aug 26, 2023
1 parent d28e997 commit 5333167
Show file tree
Hide file tree
Showing 47 changed files with 48 additions and 384 deletions.
11 changes: 3 additions & 8 deletions .github/workflows/build-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,11 @@ jobs:
with:
version: "v0.9.0"
- uses: FranzDiebold/github-env-vars-action@v1.2.1
- name: lint-test-config-reloader
run: |
cd config-reloader && make test
- name: build-base-image
- name: build-image
run: |
export TESTCONTAINERS_RYUK_DISABLED=true
cd base-image && make build-test-ci
- name: build-config-reloader
run: |
cd config-reloader && make build-image TAG=v$GITHUB_SHA_SHORT
make build-test-ci
make build-image TAG=v$GITHUB_SHA_SHORT
- name: load-image
run: |
kind load docker-image vmware/kube-fluentd-operator:v$GITHUB_SHA_SHORT
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/release-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,9 @@ jobs:
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: build-base
run: |
cd base-image && make build-image
- name: push-image
run: |
cd config-reloader && make push-image && make push-latest
make push-image && make push-latest
env:
TAG: ${{github.ref_name}}

Expand Down
21 changes: 19 additions & 2 deletions base-image/Dockerfile → Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@
# SPDX-License-Identifier: BSD-2-Clause
# Similar to https://github.com/drecom/docker-centos-ruby/blob/2.6.5-slim/Dockerfile


FROM golang:1.19 as builder

WORKDIR /go/src/github.com/vmware/kube-fluentd-operator/config-reloader
COPY config-reloader .
COPY Makefile .

# Speed up local builds where vendor is populated
ARG VERSION
# Good to have another test run as this container is different than lint container
RUN make in-docker-test
RUN make build VERSION=$VERSION

FROM photon:4.0

ARG RVM_PATH=/usr/local/rvm
Expand Down Expand Up @@ -47,7 +60,7 @@ RUN tdnf clean all && \

SHELL [ "/bin/bash", "-l", "-c" ]

COPY failsafe.conf entrypoint.sh Gemfile Gemfile.lock /fluentd/
COPY image/failsafe.conf image/entrypoint.sh image/Gemfile image/Gemfile.lock /fluentd/

# Install the gems with bundler is better practice
# We need to keep this as a single layer because of the builddeps
Expand Down Expand Up @@ -94,7 +107,11 @@ RUN tdnf install -y $BUILDDEPS \
&& tdnf remove -y $BUILDDEPS \
&& tdnf clean all

COPY plugins /fluentd/plugins
COPY image/plugins /fluentd/plugins

COPY config-reloader/templates /templates
COPY config-reloader/validate-from-dir.sh /bin/validate-from-dir.sh
COPY --from=builder /go/src/github.com/vmware/kube-fluentd-operator/config-reloader/config-reloader /bin/config-reloader

# Make sure fluentd picks jemalloc 5.3.0 lib as default
ENV LD_PRELOAD="/usr/lib/libjemalloc.so"
Expand Down
27 changes: 25 additions & 2 deletions config-reloader/Makefile → Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ DEV_ENV_CMD := docker run --rm -v ${CURRENT_DIR}:${DEV_ENV_WORK_DIR} -w ${D

all: test build

.PHONY: test-image

dev:
${DEV_ENV_CMD} bash

vendor:
${GO} mod vendor
cd config-reloader && ${GO} mod vendor

install:
${GO} install -v .
Expand Down Expand Up @@ -69,7 +71,7 @@ clean:
rm -fr config-reloader pkg > /dev/null

build-image:
docker build --build-arg VERSION=$(VERSION) -t $(IMAGE):$(TAG) .
DOCKER_BUILDKIT=1 docker build --build-arg VERSION=$(VERSION) -t $(IMAGE):$(TAG) .

push-image: build-image
docker push $(IMAGE):$(TAG)
Expand Down Expand Up @@ -161,3 +163,24 @@ shell:
docker run --entrypoint=/bin/bash \
-ti --rm -v `pwd`:/workspace --net=host \
$(IMAGE):$(TAG)

test-image: build-image
docker run -t --rm \
--net=host \
-v `pwd`:/workspace \
-v `pwd`/image/test/containers:/var/log/containers \
-v `pwd`/image/test/input.conf:/fluentd/etc/input.conf \
-v `pwd`/image/test/local.conf:/fluentd/etc/fluent.conf \
-e FLUENTD_OPT="--no-supervisor" \
$(IMAGE):$(TAG)

list-gems:
@docker run -ti --rm \
--net=host --entrypoint /bin/bash \
$(IMAGE):$(TAG) \
-c 'fluent-gem list' | \
grep '^fluent' | sed 's/^/* /'

build-test-ci: build-image
cd image && TEST_IMAGE_NAME=$(IMAGE) TEST_IMAGE_TAG=$(TAG) go test -mod=readonly -v -count=1 --race ./...
cd config-reloader && go test -mod=readonly -v -count=1 --race ./...
44 changes: 0 additions & 44 deletions base-image/Makefile

This file was deleted.

21 changes: 0 additions & 21 deletions config-reloader/Dockerfile

This file was deleted.

1 change: 0 additions & 1 deletion config-reloader/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ var _ Controller = &controllerInstance{}

// New creates new controller
func New(ctx context.Context, cfg *config.Config, ds datasource.Datasource, up Updater) (Controller, error) {

var reloader *fluentd.Reloader
gen := generator.New(ctx, cfg)
gen.SetStatusUpdater(ctx, ds)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 0 additions & 2 deletions meetup-2018-11-22/.gitignore

This file was deleted.

7 changes: 0 additions & 7 deletions meetup-2018-11-22/Dockerfile

This file was deleted.

9 changes: 0 additions & 9 deletions meetup-2018-11-22/Makefile

This file was deleted.

27 changes: 0 additions & 27 deletions meetup-2018-11-22/cat-london.yaml

This file was deleted.

27 changes: 0 additions & 27 deletions meetup-2018-11-22/cat-paris.yaml

This file was deleted.

28 changes: 0 additions & 28 deletions meetup-2018-11-22/config-london.yaml

This file was deleted.

37 changes: 0 additions & 37 deletions meetup-2018-11-22/config-paris.yaml

This file was deleted.

32 changes: 0 additions & 32 deletions meetup-2018-11-22/dog-london.yaml

This file was deleted.

Loading

0 comments on commit 5333167

Please sign in to comment.