Skip to content

Commit

Permalink
Add slim base image with Grafana and Tempo
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisBellew committed Jun 1, 2024
1 parent d8bbf5b commit eaf8728
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 27 deletions.
14 changes: 13 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,24 @@ jobs:
restore-keys: |
${{ runner.os }}-buildx
- name: Build and push Docker image
- name: Build and push base image
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile.base
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/pg-ferret:latest
platforms: linux/arm64, linux/amd64
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache

- name: Build and push all in one image
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile.all-in-one
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/pg-ferret-all-in-one:latest
platforms: linux/arm64, linux/amd64
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
31 changes: 31 additions & 0 deletions Dockerfile.all-in-one
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM cbellew/pg-ferret:latest

WORKDIR /app
COPY --from=builder /app/tempo_2.0.0_linux_*.deb /app

# Install Tempo and Grafana
RUN apt-get update \
&& apt-get install -y software-properties-common curl \
&& add-apt-repository "deb https://packages.grafana.com/oss/deb stable main" \
&& curl -s https://packages.grafana.com/gpg.key | apt-key add - \
&& apt-get update \
&& apt-get install -y grafana \
&& dpkg -i tempo_2.0.0_linux_*.deb \
&& rm tempo_2.0.0_linux_*.deb \
&& apt-get install -y grafana \
&& apt-get remove -y software-properties-common curl \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

COPY grafana.ini /etc/grafana/grafana.ini
COPY tempo.yaml /etc/tempo/tempo.yaml
COPY tempo-datasource.yaml /etc/grafana/provisioning/datasources/tempo-datasource.yaml

ENV GF_AUTH_DISABLE_LOGIN_FORM=true
ENV GF_AUTH_ANONYMOUS_ENABLED=true
ENV GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
ENV GF_SECURITY_DISABLE_INITIAL_ADMIN_CREATION=true

EXPOSE 5432 3000

ENTRYPOINT ["/usr/local/bin/start.sh"]
27 changes: 1 addition & 26 deletions Dockerfile → Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ RUN apt-get update \
&& cd bpftool/src && make install && cd /app \
&& rm -rf /var/lib/apt/lists/* /app/bpftool \
&& apt-get clean
#&& bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" \

RUN ARCH=$(uname -m) && \
if [ "$ARCH" = "x86_64" ]; then \
Expand All @@ -43,34 +42,10 @@ FROM cbellew/pg-ferret-postgres-16:latest

WORKDIR /app
COPY --from=builder /app/target/release/userspace-collector /usr/local/bin/userspace-collector
COPY --from=builder /app/tempo_2.0.0_linux_*.deb /app

# Install Tempo and Grafana
RUN apt-get update \
&& apt-get install -y software-properties-common curl \
&& add-apt-repository "deb https://packages.grafana.com/oss/deb stable main" \
&& curl -s https://packages.grafana.com/gpg.key | apt-key add - \
&& apt-get update \
&& apt-get install -y grafana \
&& dpkg -i tempo_2.0.0_linux_*.deb \
&& rm tempo_2.0.0_linux_*.deb \
&& apt-get install -y grafana \
&& apt-get remove -y software-properties-common curl \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

COPY start.sh /usr/local/bin/start.sh
RUN chmod +x /usr/local/bin/start.sh

COPY grafana.ini /etc/grafana/grafana.ini
COPY tempo.yaml /etc/tempo/tempo.yaml
COPY tempo-datasource.yaml /etc/grafana/provisioning/datasources/tempo-datasource.yaml

ENV GF_AUTH_DISABLE_LOGIN_FORM=true
ENV GF_AUTH_ANONYMOUS_ENABLED=true
ENV GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
ENV GF_SECURITY_DISABLE_INITIAL_ADMIN_CREATION=true

EXPOSE 5432 3000
EXPOSE 5432

ENTRYPOINT ["/usr/local/bin/start.sh"]

0 comments on commit eaf8728

Please sign in to comment.