mirror of
https://github.com/librenms/docker.git
synced 2026-08-02 06:43:23 +00:00
Multi-platform image
Publish edge and nightly images
This commit is contained in:
parent
97099891e1
commit
e00b3777d5
5 changed files with 87 additions and 30 deletions
75
.github/workflows/build.yml
vendored
75
.github/workflows/build.yml
vendored
|
|
@ -1,11 +1,22 @@
|
|||
name: build
|
||||
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: 'master'
|
||||
schedule:
|
||||
- cron: '0 10 * * *' # everyday at 10am
|
||||
push:
|
||||
branches: 'master'
|
||||
branches: master
|
||||
tags: '*'
|
||||
paths:
|
||||
- '.github/workflows/build.yml'
|
||||
- 'rootfs/**'
|
||||
- 'Dockerfile'
|
||||
pull_request:
|
||||
branches: master
|
||||
paths:
|
||||
- '.github/workflows/build.yml'
|
||||
- 'rootfs/**'
|
||||
- 'Dockerfile'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
|
@ -18,45 +29,57 @@ jobs:
|
|||
name: Prepare
|
||||
id: prepare
|
||||
run: |
|
||||
DOCKER_USERNAME=librenmsbot
|
||||
DOCKER_IMAGE=librenms/librenms
|
||||
DOCKER_PLATFORMS=linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/386,linux/ppc64le
|
||||
VERSION=edge
|
||||
|
||||
if [[ $GITHUB_REF == refs/tags/* ]]; then
|
||||
TAG=${GITHUB_REF#refs/tags/}
|
||||
echo ::set-output name=tag_name::${TAG}
|
||||
echo ::set-output name=version::${TAG%-*}
|
||||
else
|
||||
echo ::set-output name=version::snapshot
|
||||
VERSION=${TAG%-*}
|
||||
fi
|
||||
echo ::set-output name=build_date::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
|
||||
echo ::set-output name=docker_username::librenmsbot
|
||||
echo ::set-output name=docker_image::librenms/librenms
|
||||
if [ "${{ github.event_name }}" = "schedule" ]; then
|
||||
VERSION=nightly
|
||||
fi
|
||||
|
||||
TAGS="--tag ${DOCKER_IMAGE}:${VERSION}"
|
||||
if [ "$VERSION" != "edge" ] && [ "$VERSION" != "nightly" ]; then
|
||||
TAGS="$TAGS --tag ${DOCKER_IMAGE}:latest"
|
||||
fi
|
||||
|
||||
echo ::set-output name=docker_username::${DOCKER_USERNAME}
|
||||
echo ::set-output name=docker_image::${DOCKER_IMAGE}
|
||||
echo ::set-output name=version::${VERSION}
|
||||
echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} \
|
||||
--build-arg VERSION=${VERSION} \
|
||||
--build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \
|
||||
--build-arg VCS_REF=${GITHUB_SHA::8} \
|
||||
${TAGS} --file Dockerfile .
|
||||
-
|
||||
name: Docker Build
|
||||
name: Set up Docker Buildx
|
||||
uses: crazy-max/ghaction-docker-buildx@v2
|
||||
-
|
||||
name: Docker Buildx (build)
|
||||
run: |
|
||||
docker build \
|
||||
--build-arg "BUILD_DATE=${{ steps.prepare.outputs.build_date }}" \
|
||||
--build-arg "VCS_REF=${GITHUB_SHA::8}" \
|
||||
--build-arg "VERSION=${{ steps.prepare.outputs.version }}" \
|
||||
--tag "${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }}" \
|
||||
--tag "${{ steps.prepare.outputs.docker_image }}:latest" \
|
||||
--file Dockerfile .
|
||||
-
|
||||
name: Docker Login
|
||||
if: success() && startsWith(github.ref, 'refs/tags/')
|
||||
docker buildx build --output "type=image,push=false" ${{ steps.prepare.outputs.buildx_args }}
|
||||
- name: Docker Login
|
||||
if: success() && github.event_name != 'pull_request'
|
||||
env:
|
||||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
||||
run: |
|
||||
echo "${DOCKER_PASSWORD}" | docker login --username "${{ steps.prepare.outputs.docker_username }}" --password-stdin
|
||||
-
|
||||
name: Docker Push
|
||||
if: success() && startsWith(github.ref, 'refs/tags/')
|
||||
name: Docker Buildx (push)
|
||||
if: success() && github.event_name != 'pull_request'
|
||||
run: |
|
||||
docker push ${{ steps.prepare.outputs.docker_image }}
|
||||
docker buildx build --output "type=image,push=true" ${{ steps.prepare.outputs.buildx_args }}
|
||||
-
|
||||
name: Docker Check Manifest
|
||||
if: always() && startsWith(github.ref, 'refs/tags/')
|
||||
if: success() && github.event_name != 'pull_request'
|
||||
run: |
|
||||
docker run --rm mplatform/mquery ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }}
|
||||
-
|
||||
name: Clear
|
||||
if: always() && startsWith(github.ref, 'refs/tags/')
|
||||
if: always() && github.event_name != 'pull_request'
|
||||
run: |
|
||||
rm -f ${HOME}/.docker/config.json
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
* LibreNMS 1.64
|
||||
* Python 2 removed (librenms/librenms#11531)
|
||||
* Multi-platform image
|
||||
* Publish edge and nightly images
|
||||
|
||||
## 1.63-RC7 (2020/05/28)
|
||||
|
||||
|
|
|
|||
20
Dockerfile
20
Dockerfile
|
|
@ -1,9 +1,13 @@
|
|||
FROM alpine:3.11
|
||||
FROM --platform=${TARGETPLATFORM:-linux/amd64} alpine:3.11
|
||||
|
||||
ARG BUILD_DATE
|
||||
ARG VCS_REF
|
||||
ARG VERSION
|
||||
|
||||
ARG TARGETPLATFORM
|
||||
ARG BUILDPLATFORM
|
||||
RUN printf "I am running on ${BUILDPLATFORM:-linux/amd64}, building for ${TARGETPLATFORM:-linux/amd64}\n$(uname -a)\n"
|
||||
|
||||
LABEL maintainer="CrazyMax" \
|
||||
org.opencontainers.image.created=$BUILD_DATE \
|
||||
org.opencontainers.image.url="https://github.com/librenms/docker" \
|
||||
|
|
@ -82,10 +86,20 @@ RUN apk --update --no-cache add \
|
|||
mariadb-dev \
|
||||
musl-dev \
|
||||
python3-dev \
|
||||
&& S6_ARCH=$(case ${TARGETPLATFORM:-linux/amd64} in \
|
||||
"linux/amd64") echo "amd64" ;; \
|
||||
"linux/arm/v6") echo "arm" ;; \
|
||||
"linux/arm/v7") echo "armhf" ;; \
|
||||
"linux/arm64") echo "aarch64" ;; \
|
||||
"linux/386") echo "x86" ;; \
|
||||
"linux/ppc64le") echo "ppc64le" ;; \
|
||||
*) echo "" ;; esac) \
|
||||
&& echo "S6_ARCH=$S6_ARCH" \
|
||||
&& wget -q "https://github.com/just-containers/s6-overlay/releases/latest/download/s6-overlay-${S6_ARCH}.tar.gz" -qO "/tmp/s6-overlay-${S6_ARCH}.tar.gz" \
|
||||
&& tar xzf /tmp/s6-overlay-${S6_ARCH}.tar.gz -C / \
|
||||
&& s6-echo "s6-overlay installed" \
|
||||
&& pip3 install --upgrade pip \
|
||||
&& pip3 install python-memcached mysqlclient --upgrade \
|
||||
&& wget -q "https://github.com/just-containers/s6-overlay/releases/latest/download/s6-overlay-amd64.tar.gz" -qO "/tmp/s6-overlay-amd64.tar.gz" \
|
||||
&& tar xzf /tmp/s6-overlay-amd64.tar.gz -C / \
|
||||
&& curl -sSL https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer \
|
||||
&& apk del build-dependencies \
|
||||
&& rm -rf /var/cache/apk/* /var/www/* /tmp/* \
|
||||
|
|
|
|||
18
README.md
18
README.md
|
|
@ -23,6 +23,7 @@ If you are interested, [check out](https://hub.docker.com/r/crazymax/) my other
|
|||
## Features
|
||||
|
||||
* Run as non-root user
|
||||
* Multi-platform image
|
||||
* [Dispatcher service](doc/docker/environment-variables.md#dispatcher-service) or legacy [cron](doc/docker/environment-variables.md#cron-legacy) as "sidecar" containers
|
||||
* Syslog-ng support through a ["sidecar" container](doc/docker/environment-variables.md#syslog-ng)
|
||||
* Ability to configure [distributed polling](https://docs.librenms.org/Extensions/Distributed-Poller/)
|
||||
|
|
@ -36,6 +37,23 @@ If you are interested, [check out](https://hub.docker.com/r/crazymax/) my other
|
|||
* [msmtpd SMTP relay](https://github.com/crazy-max/docker-msmtpd) image to send emails
|
||||
* [MariaDB](https://github.com/docker-library/mariadb) image as database instance
|
||||
|
||||
## Multi-platform image
|
||||
|
||||
Following platforms for this image are available:
|
||||
|
||||
```
|
||||
$ docker run --rm mplatform/mquery librenms/librenms:latest
|
||||
Image: librenms/librenms:latest
|
||||
* Manifest List: Yes
|
||||
* Supported platforms:
|
||||
- linux/amd64
|
||||
- linux/arm/v6
|
||||
- linux/arm/v7
|
||||
- linux/arm64
|
||||
- linux/386
|
||||
- linux/ppc64le
|
||||
```
|
||||
|
||||
## Documentation
|
||||
|
||||
* Docker
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
### Ports
|
||||
## Ports
|
||||
|
||||
* `8000`: HTTP port
|
||||
* `514 514/udp`: Syslog ports (only used if you enable and run a [sidecar syslog-ng container](../notes/syslog-ng.md))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue