Added multi-arch Alpine Dockerfiles

pull/8/head
Heiner 2020-04-19 18:01:30 +02:00
rodzic 077bb91f51
commit 07082496ad
13 zmienionych plików z 174 dodań i 38 usunięć

Wyświetl plik

@ -1,40 +1,29 @@
FROM debian:jessie
MAINTAINER Heiner Peuser <heiner.peuser@weweave.net>
FROM amd64/alpine:3.11
ARG BUILD_DATE
ARG VCS_REF
LABEL org.label-schema.build-date=$BUILD_DATE \
org.label-schema.name="Docker Container Stats" \
org.label-schema.description="Monitor your docker containers with this web interface." \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.vcs-url="https://github.com/virtualzone/docker-container-stats" \
org.label-schema.schema-version="1.0"
ENV LANG C.UTF-8
ENV HOME /root
ENV DEBIAN_FRONTEND noninteractive
RUN echo "deb http://debian-mirrors.sdinet.de/deb-multimedia stable main non-free" >> /etc/apt/sources.list
RUN apt-get update && apt-get install -y --force-yes \
curl \
RUN apk --update add --no-cache \
supervisor \
wget
RUN curl -sL https://deb.nodesource.com/setup_5.x | bash - && \
apt-get install -y nodejs sqlite3
RUN curl -fsSL https://get.docker.com/ | sh
RUN cd /bin && \
wget https://github.com/ohjames/smell-baron/releases/download/v0.3.0/smell-baron && \
chmod a+x smell-baron
RUN mkdir /opt/docker-stats
RUN mkdir /opt/docker-stats/db
nodejs \
npm \
docker \
sqlite
RUN mkdir -p /opt/docker-stats/db
RUN cd /opt/docker-stats && \
npm update && \
npm install express sqlite3 body-parser moment
RUN apt-get clean
RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ADD stats.js /opt/docker-stats/
ADD httpd.js /opt/docker-stats/
ADD html/ /opt/docker-stats/html/
ADD supervisord.conf /etc/supervisor/conf.d/supervisord.conf
ADD supervisord.conf /etc/supervisord.conf
EXPOSE 8080
ENTRYPOINT ["/bin/smell-baron"]
CMD ["/usr/bin/supervisord"]

35
Dockerfile.arm32v6 100644
Wyświetl plik

@ -0,0 +1,35 @@
FROM alpine:3.11 AS qemu
RUN apk --update add --no-cache curl
RUN cd /tmp && \
curl -L https://github.com/balena-io/qemu/releases/download/v3.0.0%2Bresin/qemu-3.0.0+resin-arm.tar.gz | tar zxvf - -C . && mv qemu-3.0.0+resin-arm/qemu-arm-static .
FROM arm32v6/alpine:3.11
COPY --from=qemu /tmp/qemu-arm-static /usr/bin/
ARG BUILD_DATE
ARG VCS_REF
LABEL org.label-schema.build-date=$BUILD_DATE \
org.label-schema.name="Docker Container Stats" \
org.label-schema.description="Monitor your docker containers with this web interface." \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.vcs-url="https://github.com/virtualzone/docker-container-stats" \
org.label-schema.schema-version="1.0"
RUN apk --update add --no-cache \
supervisor \
nodejs \
npm \
docker \
sqlite
RUN mkdir -p /opt/docker-stats/db
RUN cd /opt/docker-stats && \
npm update && \
npm install express sqlite3 body-parser moment
ADD stats.js /opt/docker-stats/
ADD httpd.js /opt/docker-stats/
ADD html/ /opt/docker-stats/html/
ADD supervisord.conf /etc/supervisord.conf
EXPOSE 8080
CMD ["/usr/bin/supervisord"]

35
Dockerfile.arm32v7 100644
Wyświetl plik

@ -0,0 +1,35 @@
FROM alpine:3.11 AS qemu
RUN apk --update add --no-cache curl
RUN cd /tmp && \
curl -L https://github.com/balena-io/qemu/releases/download/v3.0.0%2Bresin/qemu-3.0.0+resin-arm.tar.gz | tar zxvf - -C . && mv qemu-3.0.0+resin-arm/qemu-arm-static .
FROM arm32v7/alpine:3.11
COPY --from=qemu /tmp/qemu-arm-static /usr/bin/
ARG BUILD_DATE
ARG VCS_REF
LABEL org.label-schema.build-date=$BUILD_DATE \
org.label-schema.name="Docker Container Stats" \
org.label-schema.description="Monitor your docker containers with this web interface." \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.vcs-url="https://github.com/virtualzone/docker-container-stats" \
org.label-schema.schema-version="1.0"
RUN apk --update add --no-cache \
supervisor \
nodejs \
npm \
docker \
sqlite
RUN mkdir -p /opt/docker-stats/db
RUN cd /opt/docker-stats && \
npm update && \
npm install express sqlite3 body-parser moment
ADD stats.js /opt/docker-stats/
ADD httpd.js /opt/docker-stats/
ADD html/ /opt/docker-stats/html/
ADD supervisord.conf /etc/supervisord.conf
EXPOSE 8080
CMD ["/usr/bin/supervisord"]

35
Dockerfile.arm64v8 100644
Wyświetl plik

@ -0,0 +1,35 @@
FROM alpine:3.11 AS qemu
RUN apk --update add --no-cache curl
RUN cd /tmp && \
curl -L https://github.com/balena-io/qemu/releases/download/v3.0.0%2Bresin/qemu-3.0.0+resin-aarch64.tar.gz | tar zxvf - -C . && mv qemu-3.0.0+resin-aarch64/qemu-aarch64-static .
FROM arm64v8/alpine:3.11
COPY --from=qemu /tmp/qemu-aarch64-static /usr/bin/
ARG BUILD_DATE
ARG VCS_REF
LABEL org.label-schema.build-date=$BUILD_DATE \
org.label-schema.name="Docker Container Stats" \
org.label-schema.description="Monitor your docker containers with this web interface." \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.vcs-url="https://github.com/virtualzone/docker-container-stats" \
org.label-schema.schema-version="1.0"
RUN apk --update add --no-cache \
supervisor \
nodejs \
npm \
docker \
sqlite
RUN mkdir -p /opt/docker-stats/db
RUN cd /opt/docker-stats && \
npm update && \
npm install express sqlite3 body-parser moment
ADD stats.js /opt/docker-stats/
ADD httpd.js /opt/docker-stats/
ADD html/ /opt/docker-stats/html/
ADD supervisord.conf /etc/supervisord.conf
EXPOSE 8080
CMD ["/usr/bin/supervisord"]

Wyświetl plik

@ -3,7 +3,7 @@ A web interface for viewing historical and current statistics per docker contain
Pull and run daemonized:
```
docker pull weweave/docker-container-stats
docker pull virtualzone/docker-container-stats
docker run \
-d \
-p 8080:8080 \
@ -11,7 +11,7 @@ docker run \
--volume=/var/run/docker.sock:/var/run/docker.sock:ro \
--volume=/home/docker/storage/stats/db:/opt/docker-stats/db \
--name stats \
weweave/docker-container-stats
virtualzone/docker-container-stats
```
Docker-Compose:
@ -20,7 +20,7 @@ Docker-Compose:
version: '3.6'
services:
stats:
image: weweave/docker-container-stats
image: virtualzone/docker-container-stats
container_name: 'stats'
ports:
- '8080:8080'
@ -40,8 +40,8 @@ Mounting the volume /opt/docker-stats/db is optional. You can use it if you want
We strongly recommend not making your stats available online. To password protect your statistics, you can use a frontend web server/proxy (Apache, nginx, ...).
## Screenshots
![All containers' memory usage](https://raw.githubusercontent.com/weweave/docker-container-stats/master/img/all-containers-mem.png)
![All containers' memory usage](https://raw.githubusercontent.com/virtualzone/docker-container-stats/master/img/all-containers-mem.png)
![All containers' inbound network traffic](https://raw.githubusercontent.com/weweave/docker-container-stats/master/img/all-containers-net.png)
![All containers' inbound network traffic](https://raw.githubusercontent.com/virtualzone/docker-container-stats/master/img/all-containers-net.png)
![Selected container's latest statistics](https://raw.githubusercontent.com/weweave/docker-container-stats/master/img/selected-container.png)
![Selected container's latest statistics](https://raw.githubusercontent.com/virtualzone/docker-container-stats/master/img/selected-container.png)

8
hooks/build 100755
Wyświetl plik

@ -0,0 +1,8 @@
#!/bin/bash
docker build \
--file "${DOCKERFILE_PATH}" \
--build-arg BUILD_DATE="$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
--build-arg VCS_REF="$(git rev-parse --short HEAD)" \
--tag "$IMAGE_NAME" \
.

6
hooks/post_push 100755
Wyświetl plik

@ -0,0 +1,6 @@
#!/bin/bash
curl -Lo manifest-tool https://github.com/estesp/manifest-tool/releases/download/v1.0.0/manifest-tool-linux-amd64
chmod +x manifest-tool
# Apply to latest
./manifest-tool push from-spec multi-arch-manifest.yaml

8
hooks/pre_build 100755
Wyświetl plik

@ -0,0 +1,8 @@
#!/bin/bash
BUILD_ARCH=$(echo "${DOCKERFILE_PATH}" | cut -d '.' -f 2)
[ "${BUILD_ARCH}" == "Dockerfile" ] && \
{ echo 'qemu-user-static: Registration not required for current arch'; exit 0; }
docker run --rm --privileged multiarch/qemu-user-static:register --reset

Wyświetl plik

@ -92,7 +92,7 @@
<div class="alert alert-warning chart-warn" id="block-out-chart-warn" role="alert">No data for specified zoom level.</div>
<footer>
Developed by <a href="https://weweave.net">weweave</a>. Source available on <a href="https://github.com/weweave/docker-container-stats">GitHub</a>.
Source available on <a href="https://github.com/virtualzone/docker-container-stats">GitHub</a>.
</footer>
</div>
<script type="text/javascript" src="js/jquery-2.2.1.min.js"></script>

Wyświetl plik

@ -7,7 +7,7 @@ var moment = require('moment');
var express = require("express");
var app = express();
var db = new sqlite3.Database(DB_FILE, sqlite3.OPEN_READONLY));
var db = new sqlite3.Database(DB_FILE, sqlite3.OPEN_READONLY);
var isValidChart = function(s) {
return /^(net_in|net_out|block_in|block_out|mem)$/.test(s);

Wyświetl plik

@ -0,0 +1,21 @@
image: virtualzone/docker-container-stats:latest
manifests:
- image: virtualzone/docker-container-stats:amd64
platform:
architecture: amd64
os: linux
- image: virtualzone/docker-container-stats:arm32v6
platform:
architecture: arm
os: linux
variant: v6
- image: virtualzone/docker-container-stats:arm32v7
platform:
architecture: arm
os: linux
variant: v7
- image: virtualzone/docker-container-stats:arm64v8
platform:
architecture: arm64
os: linux
variant: v8

Wyświetl plik

@ -4,7 +4,6 @@ var INTERVAL = 60;
var TEST = false;
var sqlite3 = require('sqlite3').verbose();
var exec = require('child_process').execFileSync;
var spawn = require('child_process').spawnSync;
var moment = require('moment');
var fs = require('fs');

Wyświetl plik

@ -2,7 +2,7 @@
nodaemon=true
[program:stats]
command=/usr/bin/nodejs stats.js
command=/usr/bin/node stats.js
directory=/opt/docker-stats
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
@ -10,7 +10,7 @@ stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
[program:httpd]
command=/usr/bin/nodejs httpd.js
command=/usr/bin/node httpd.js
directory=/opt/docker-stats
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0