How can I add fluent-bit to an image that builds on docker:latest
?
I have tried this:
FROM docker:latest
RUN apk add python3 py-pip python3-dev libffi-dev openssl-dev gcc libc-dev make curl libc6-compat
RUN apk add --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing/
ENTRYPOINT ["/fluent-bit/bin/fluent-bit", "-c", "/fluent-bit/etc/fluent-bit.conf"]
But it does not find /fluent-bit/bin/fluent-bit
. I do need Python, Docker, and all the other specified dependencies.
I ended up installing docker and fluent-bit in a Python Debian image, and it works. Dockerfile:
FROM python:3.11-slim-buster
# install dependencies
RUN apt-get update
RUN apt-get upgrade
RUN apt-get install -y curl bash gpg
# install fluent-bit
RUN curl https://raw.githubusercontent.com/fluent/fluent-bit/master/install.sh | sh
ENV PATH="/opt/fluent-bit/bin:${PATH}"
# install concurrently
RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash -
RUN apt install nodejs
RUN npm install --global concurrently
# install docker
RUN apt update
RUN apt install -y apt-transport-https ca-certificates curl gnupg2 software-properties-common
RUN curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
RUN add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
RUN apt update
RUN apt-cache policy docker-ce
RUN apt install -y docker-ce
# set up custom files
RUN mkdir -p /app
RUN mkdir -p /logs
COPY uploader/sync.py /app/sync.py
COPY uploader/entrypoint.sh /app/entrypoint.sh
RUN chmod +x /app/entrypoint.sh
ENTRYPOINT /app/entrypoint.sh
entrypoint.sh:
command1="python3 /app/sync.py --compose_project_name $COMPOSE_PROJECT_NAME"
command2="/opt/fluent-bit/bin/fluent-bit -c /fluent-bit/etc/fluent-bit.conf"
concurrently "$command1" "$command2"