Enhance Dockerfile: Install Grafana and Prometheus with proper cleanup
Browse files- Dockerfile +21 -0
Dockerfile
CHANGED
|
@@ -23,6 +23,27 @@ RUN useradd -m -u 1000 user
|
|
| 23 |
# Set working directory
|
| 24 |
WORKDIR /app
|
| 25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
# Copy requirements first for caching
|
| 27 |
COPY requirements.txt .
|
| 28 |
|
|
|
|
| 23 |
# Set working directory
|
| 24 |
WORKDIR /app
|
| 25 |
|
| 26 |
+
# Grafana
|
| 27 |
+
RUN apt-get update && apt-get install -y wget apt-transport-https software-properties-common && \
|
| 28 |
+
wget -q -O /usr/share/keyrings/grafana.key https://apt.grafana.com/gpg.key && \
|
| 29 |
+
echo "deb [signed-by=/usr/share/keyrings/grafana.key] https://apt.grafana.com stable main" | tee /etc/apt/sources.list.d/grafana.list && \
|
| 30 |
+
apt-get update && \
|
| 31 |
+
apt-get install -y grafana && \
|
| 32 |
+
apt-get clean && \
|
| 33 |
+
rm -rf /var/lib/apt/lists/*
|
| 34 |
+
|
| 35 |
+
# Prometheus
|
| 36 |
+
RUN wget https://github.com/prometheus/prometheus/releases/download/v2.45.0/prometheus-2.45.0.linux-amd64.tar.gz && \
|
| 37 |
+
tar xvfz prometheus-*.tar.gz && \
|
| 38 |
+
mv prometheus-*/prometheus /usr/local/bin/ && \
|
| 39 |
+
mv prometheus-*/promtool /usr/local/bin/ && \
|
| 40 |
+
mkdir -p /etc/prometheus /var/lib/prometheus && \
|
| 41 |
+
rm -rf prometheus-*
|
| 42 |
+
|
| 43 |
+
COPY monitoring/grafana/provisioning /etc/grafana/provisioning
|
| 44 |
+
COPY monitoring/grafana/dashboards /var/lib/grafana/dashboards
|
| 45 |
+
COPY monitoring/prometheus/prometheus.yml /etc/prometheus/prometheus.yml
|
| 46 |
+
|
| 47 |
# Copy requirements first for caching
|
| 48 |
COPY requirements.txt .
|
| 49 |
|