44 Commits

Author SHA1 Message Date
github-actions[bot]
a540a56772 docs: auto update README.md 2025-07-31 07:02:52 +00:00
github-actions[bot]
51147b410f [upgrade] 0.52.2 2025-07-31 05:21:24 +00:00
github-actions[bot]
6009688b0f docs: auto update README.md 2025-07-30 06:45:34 +00:00
github-actions[bot]
edb2566b92 [upgrade] 0.52.1 2025-07-30 05:23:23 +00:00
github-actions[bot]
00c07f3db6 docs: auto update README.md 2025-07-22 07:15:45 +00:00
github-actions[bot]
c87afae7c4 [upgrade] 0.51.2 2025-07-22 05:18:45 +00:00
github-actions[bot]
791dba8ff4 docs: auto update README.md 2025-07-16 06:47:32 +00:00
github-actions[bot]
88667db760 [upgrade] 0.51.1 2025-07-16 05:19:48 +00:00
github-actions[bot]
0ffc28b553 docs: auto update README.md 2025-07-15 19:52:23 +00:00
github-actions[bot]
d3be14f9f9 docs: auto update README.md 2025-07-15 15:48:44 +00:00
github-actions[bot]
5b9a82e25c [upgrade] 0.51.0 2025-07-15 14:19:48 +00:00
github-actions[bot]
9affbbf742 docs: auto update README.md 2025-07-15 14:18:37 +00:00
ElevenNotes
c452c17583 feat: add docs commit to auto README.md update 2025-07-14 23:29:40 +02:00
ElevenNotes
d062133a27 fix(CI/CD)!: removal of armv7 as non-standard deployment option
Default building armv72 (32bit) images will be disabled from now on
2025-07-14 20:31:20 +02:00
ElevenNotes
d4d83345ee Merge branch 'master' of https://github.com/11notes/docker-netbird 2025-07-14 16:47:27 +02:00
ElevenNotes
2a2de68337 feat: 11notes/go as build image 2025-07-14 16:47:18 +02:00
ElevenNotes
2016f9671f feat: new postgres image and yml anchor 2025-07-14 16:47:05 +02:00
ElevenNotes
578132e39b chore: change UVP 2025-07-14 16:46:51 +02:00
github-actions[bot]
16566a986b [upgrade] 0.50.3 2025-07-13 05:15:42 +00:00
ElevenNotes
57eb9f32a8 Merge branch 'master' of https://github.com/11notes/docker-netbird 2025-07-11 07:53:07 +02:00
ElevenNotes
6279ff8a3e [upgrade] latest workflows 2025-07-11 07:39:26 +02:00
github-actions[bot]
8e12d4bd93 [upgrade] 0.50.2 2025-07-11 05:17:09 +00:00
github-actions[bot]
dd3f45d9e1 [upgrade] 0.50.1 2025-07-07 05:16:31 +00:00
github-actions[bot]
1ec95a01fe [upgrade] 0.50.0 2025-07-05 05:12:37 +00:00
github-actions[bot]
07865a5822 [upgrade] 0.49.0 2025-06-26 05:13:55 +00:00
github-actions[bot]
01c67f15b5 github-actions[bot]: update README.md 2025-06-23 13:37:07 +00:00
github-actions[bot]
e7836fd06e github-actions[bot]: update README.md 2025-06-23 13:33:09 +00:00
github-actions[bot]
ae5c66a0a7 github-actions[bot]: update README.md 2025-06-23 13:20:27 +00:00
github-actions[bot]
525d571a6f github-actions[bot]: update README.md 2025-06-23 12:37:50 +00:00
ElevenNotes
5f2627bc23 Merge branch 'master' of https://github.com/11notes/docker-netbird 2025-06-23 14:31:49 +02:00
ElevenNotes
a7aa89da46 [feature] allow compose.yml 2025-06-23 14:31:42 +02:00
github-actions[bot]
4e4cc73219 github-actions[bot]: update README.md 2025-06-23 12:27:46 +00:00
github-actions[bot]
2ebb22bcb4 github-actions[bot]: update README.md 2025-06-23 09:56:37 +00:00
ElevenNotes
8e03b00dd1 [fix] highlight optional images 2025-06-23 11:55:08 +02:00
ElevenNotes
309212d544 [feature] add introduction 2025-06-23 11:54:56 +02:00
ElevenNotes
ccefe55008 Merge branch 'master' of https://github.com/11notes/docker-netbird 2025-06-23 11:36:16 +02:00
ElevenNotes
23f824b416 [feature] add arm/v7 2025-06-23 11:36:07 +02:00
github-actions[bot]
3d52be2e24 [upgrade] 0.48.0 2025-06-23 09:31:02 +00:00
ElevenNotes
4a8b873241 [fix] reset auto update to 0.47.2 2025-06-23 11:26:46 +02:00
github-actions[bot]
9f5920d957 [upgrade] 0.48.0 2025-06-21 05:12:04 +00:00
github-actions[bot]
c5ccc3a5e2 github-actions[bot]: update README.md 2025-06-19 05:33:44 +00:00
github-actions[bot]
3e9a1ef4e0 [upgrade] 0.47.2 2025-06-19 05:13:15 +00:00
github-actions[bot]
dc91d28923 github-actions[bot]: update README.md 2025-06-18 10:48:14 +00:00
ElevenNotes
979401dd46 [fix] add more infos 2025-06-18 12:10:06 +02:00
7 changed files with 398 additions and 94 deletions

70
.github/workflows/cve.yml vendored Normal file
View File

@@ -0,0 +1,70 @@
name: cve
on:
workflow_dispatch:
schedule:
- cron: "30 15 */2 * *"
jobs:
cve:
runs-on: ubuntu-latest
steps:
- name: init / checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
ref: ${{ github.ref_name }}
fetch-depth: 0
- name: init / setup environment
uses: actions/github-script@62c3794a3eb6788d9a2a72b219504732c0c9a298
with:
script: |
const { existsSync, readFileSync } = require('node:fs');
const { resolve } = require('node:path');
const { inspect } = require('node:util');
const { Buffer } = require('node:buffer');
const inputs = `${{ toJSON(github.event.inputs) }}`;
const opt = {input:{}, dot:{}};
try{
if(inputs.length > 0){
opt.input = JSON.parse(inputs);
if(opt.input?.etc){
opt.input.etc = JSON.parse(Buffer.from(opt.input.etc, 'base64').toString('ascii'));
}
}
}catch(e){
core.warning('could not parse github.event.inputs');
}
try{
const path = resolve('.json');
if(existsSync(path)){
try{
opt.dot = JSON.parse(readFileSync(path).toString());
}catch(e){
throw new Error('could not parse .json');
}
}else{
throw new Error('.json does not exist');
}
}catch(e){
core.setFailed(e);
}
core.info(inspect(opt, {showHidden:false, depth:null, colors:true}));
core.exportVariable('WORKFLOW_IMAGE', `${opt.dot.image}:${(opt.dot?.semver?.version === undefined) ? 'rolling' : opt.dot.semver.version}`);
core.exportVariable('WORKFLOW_GRYPE_SEVERITY_CUTOFF', (opt.dot?.grype?.severity || 'high'));
- name: grype / scan
id: grype
uses: anchore/scan-action@dc6246fcaf83ae86fcc6010b9824c30d7320729e
with:
image: ${{ env.WORKFLOW_IMAGE }}
fail-build: true
severity-cutoff: ${{ env.WORKFLOW_GRYPE_SEVERITY_CUTOFF }}
output-format: 'sarif'
by-cve: true
cache-db: true

View File

@@ -16,6 +16,7 @@ on:
required: false
default: 'ubuntu-22.04'
build:
description: 'set WORKFLOW_BUILD'
required: false
@@ -100,7 +101,7 @@ jobs:
const docker = {
image:{
name:opt.dot.image,
arch:(opt.dot.arch || 'linux/amd64,linux/arm64'),
arch:(opt.input?.etc?.arch || opt.dot?.arch || 'linux/amd64,linux/arm64'),
prefix:((opt.input?.etc?.semverprefix) ? `${opt.input?.etc?.semverprefix}-` : ''),
suffix:((opt.input?.etc?.semversuffix) ? `-${opt.input?.etc?.semversuffix}` : ''),
description:(opt.dot?.readme?.description || ''),
@@ -227,7 +228,7 @@ jobs:
with:
driver-opts: network=host
- name: docker / build & push & tag grype
- name: docker / build image locally
if: env.WORKFLOW_BUILD == 'true'
id: docker-build
uses: docker/build-push-action@67a2d409c0a876cbe6b11854e3e25193efe4e62d
@@ -256,7 +257,7 @@ jobs:
cache-db: true
- name: grype / fail
if: env.WORKFLOW_BUILD == 'true' && (failure() || steps.grype.outcome == 'failure')
if: env.WORKFLOW_BUILD == 'true' && (failure() || steps.grype.outcome == 'failure') && steps.docker-build.outcome == 'success'
uses: anchore/scan-action@dc6246fcaf83ae86fcc6010b9824c30d7320729e
with:
image: ${{ env.DOCKER_CACHE_GRYPE }}
@@ -266,7 +267,7 @@ jobs:
by-cve: true
cache-db: true
- name: docker / build & push
- name: docker / build image from cache and push to registries
if: env.WORKFLOW_BUILD == 'true'
uses: docker/build-push-action@67a2d409c0a876cbe6b11854e3e25193efe4e62d
with:
@@ -412,10 +413,13 @@ jobs:
if [ -f compose.yaml ]; then
git add compose.yaml
fi
if [ -f compose.yml ]; then
git add compose.yml
fi
if [ -f LICENSE ]; then
git add LICENSE
fi
git commit -m "github-actions[bot]: update README.md"
git commit -m "docs: auto update README.md"
git push origin HEAD:master

21
.json
View File

@@ -1,16 +1,15 @@
{
"image":"11notes/netbird",
"name":"netbird",
"root":"/netbird",
"semver":{
"version":"0.46.0"
"image": "11notes/netbird",
"name": "netbird",
"root": "/netbird",
"semver": {
"version": "0.52.2"
},
"readme":{
"description":"Run netbird rootless and distroless from a single image",
"built":{
"netbirdio/netbird":"https://github.com/netbirdio/netbird"
"readme": {
"description": "Run netbird rootless and distroless from a single image.",
"introduction": "NetBird combines a WireGuard-based overlay network with Zero Trust Network Access, providing a unified open source platform for reliable and secure connectivity. Create your own selfhosted ZTNA mesh network.",
"built": {
"netbirdio/netbird": "https://github.com/netbirdio/netbird"
},
"distroless": {
"layers": [

259
README.md Normal file
View File

@@ -0,0 +1,259 @@
![banner](https://github.com/11notes/defaults/blob/main/static/img/banner.png?raw=true)
# NETBIRD
![size](https://img.shields.io/docker/image-size/11notes/netbird/0.52.2?color=0eb305)![5px](https://github.com/11notes/defaults/blob/main/static/img/transparent5x2px.png?raw=true)![version](https://img.shields.io/docker/v/11notes/netbird/0.52.2?color=eb7a09)![5px](https://github.com/11notes/defaults/blob/main/static/img/transparent5x2px.png?raw=true)![pulls](https://img.shields.io/docker/pulls/11notes/netbird?color=2b75d6)![5px](https://github.com/11notes/defaults/blob/main/static/img/transparent5x2px.png?raw=true)[<img src="https://img.shields.io/github/issues/11notes/docker-NETBIRD?color=7842f5">](https://github.com/11notes/docker-NETBIRD/issues)![5px](https://github.com/11notes/defaults/blob/main/static/img/transparent5x2px.png?raw=true)![swiss_made](https://img.shields.io/badge/Swiss_Made-FFFFFF?labelColor=FF0000&logo=data:image/svg%2bxml;base64,PHN2ZyB2ZXJzaW9uPSIxIiB3aWR0aD0iNTEyIiBoZWlnaHQ9IjUxMiIgdmlld0JveD0iMCAwIDMyIDMyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxyZWN0IHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIgZmlsbD0idHJhbnNwYXJlbnQiLz4KICA8cGF0aCBkPSJtMTMgNmg2djdoN3Y2aC03djdoLTZ2LTdoLTd2LTZoN3oiIGZpbGw9IiNmZmYiLz4KPC9zdmc+)
Run netbird rootless and distroless from a single image.
# INTRODUCTION 📢
NetBird combines a WireGuard-based overlay network with Zero Trust Network Access, providing a unified open source platform for reliable and secure connectivity. Create your own selfhosted ZTNA mesh network.
# SYNOPSIS 📖
**What can I do with this?** This image will run netbird from a single image (not multiple) [rootless](https://github.com/11notes/RTFM/blob/main/linux/container/image/rootless.md) and [distroless](https://github.com/11notes/RTFM/blob/main/linux/container/image/distroless.md) for more security. Due to the nature of a single image and not multiple, you see in the [compose.yaml](https://github.com/11notes/docker-netbird/blob/master/compose.yaml) example that an ```entrypoint:``` has been defined for each service. This image also needs some environment variables present in your **.env** file. This image's defaults (management.json) as well as the example **.env** are to be used with Keycloak as your IdP and Traefik as your reverse proxy. You can however provide your own **management.json** file and use any IdP you like and use a different reverse proxy.
The init binary **management** will replace all variables in the format ```${VARIABLE}``` with all environment variables present in the service.
# UNIQUE VALUE PROPOSITION 💶
**Why should I run this image and not the other image(s) that already exist?** Good question! Because ...
> [!IMPORTANT]
>* ... this image runs [rootless](https://github.com/11notes/RTFM/blob/main/linux/container/image/rootless.md) as 1000:1000
>* ... this image has no shell since it is [distroless](https://github.com/11notes/RTFM/blob/main/linux/container/image/distroless.md)
>* ... this image is auto updated to the latest version via CI/CD
>* ... this image has a health check
>* ... this image runs read-only
>* ... this image is automatically scanned for CVEs before and after publishing
>* ... this image is created via a secure and pinned CI/CD process
>* ... this image is very small
If you value security, simplicity and optimizations to the extreme, then this image might be for you.
# COMPARISON 🏁
Below you find a comparison between this image and the most used or original one.
| **image** | 11notes/netbird | netbirdio/* |
| ---: | :---: | :---: |
| **image size on disk** | 44.6MB | 377.9MB |
| **process UID/GID** | 1000/1000 | 0/0 |
| **distroless?** | ✅ | ❌ |
| **rootless?** | ✅ | ❌ |
# VOLUMES 📁
* **/netbird/etc** - Directory of your management.json config
* **/netbird/var** - Directory of dynamic data from different init systems (relay, signal, management)
# EXAMPLE ENV FILE 📑
```ini
# postgres settings
POSTGRES_PASSWORD=
# netbird settings
NETBIRD_RELAY_SECRET=
NETBIRD_DATASTORE_ENCRYPTION_KEY=
NETBIRD_FQDN=netbird.domain.com
# Keycloak settings
KEYCLOAK_FQDN=keycloak.domain.com
KEYCLOAK_REALM=netbird
KEYCLOAK_CLIENT_SECRET=
# STUN/TURN configuration
STUN_FQDN_AND_PORT=turn.domain.com:5349
TURN_FQDN_AND_PORT=turn.domain.com:5349
TURN_SECRET=
```
# COMPOSE ✂️
```yaml
name: "netbird"
x-image-netbird: &image
image: "11notes/netbird:0.52.2"
read_only: true
services:
db:
image: "11notes/postgres:16"
read_only: true
environment:
TZ: "Europe/Zurich"
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
# make a full and compressed database backup each day at 03:00
POSTGRES_BACKUP_SCHEDULE: "0 3 * * *"
volumes:
- "db.etc:/postgres/etc"
- "db.var:/postgres/var"
- "db.backup:/postgres/backup"
tmpfs:
# needed for read-only
- "/postgres/run:uid=1000,gid=1000"
- "/postgres/log:uid=1000,gid=1000"
networks:
backend:
restart: "always"
dashboard:
<<: *image
environment:
NETBIRD_MGMT_API_ENDPOINT: "https://${NETBIRD_FQDN}"
NETBIRD_MGMT_GRPC_API_ENDPOINT: "https://${NETBIRD_FQDN}"
AUTH_AUDIENCE: "netbird-client"
AUTH_CLIENT_ID: "netbird-client"
AUTH_CLIENT_SECRET:
AUTH_AUTHORITY: "https://${KEYCLOAK_FQDN}/realms/${KEYCLOAK_REALM}"
USE_AUTH0: false
AUTH_SUPPORTED_SCOPES: "openid"
NETBIRD_TOKEN_SOURCE: "accessToken"
entrypoint: ["/usr/local/bin/dashboard"]
volumes:
- "dashboard.var:/nginx/var"
tmpfs:
- "/nginx/cache:uid=1000,gid=1000"
- "/nginx/run:uid=1000,gid=1000"
networks:
frontend:
ports:
- "3000:3000/tcp"
healthcheck:
test: ["CMD", "/usr/local/bin/curl", "-kILs", "--fail", "http://localhost:3000/ping"]
interval: 5s
timeout: 2s
start_period: 5s
restart: "always"
management:
depends_on:
db:
condition: "service_healthy"
restart: true
<<: *image
env_file: '.env'
environment:
TZ: "Europe/Zurich"
NETBIRD_STORE_ENGINE_POSTGRES_DSN: "host=db user=postgres password=${POSTGRES_PASSWORD} dbname=postgres port=5432"
NB_ACTIVITY_EVENT_STORE_ENGINE: "postgres"
NB_ACTIVITY_EVENT_POSTGRES_DSN: "host=db user=postgres password=${POSTGRES_PASSWORD} dbname=postgres port=5432"
entrypoint: ["/usr/local/bin/management"]
volumes:
- "management.etc:/netbird/etc"
- "management.var:/netbird/var"
networks:
frontend:
backend:
ports:
- "3080:80/tcp"
- "33073:33073/tcp"
sysctls:
net.ipv4.ip_unprivileged_port_start: 80
healthcheck:
test: ["CMD", "/usr/local/bin/curl", "-kILs", "--fail", "http://localhost:9090/metrics"]
interval: 5s
timeout: 2s
start_period: 5s
restart: "always"
signal:
<<: *image
environment:
TZ: "Europe/Zurich"
entrypoint: ["/usr/local/bin/signal"]
command: [
"run",
"--log-file", "console",
"--log-level", "info"
]
volumes:
- "signal.var:/netbird/var"
networks:
frontend:
ports:
- "10000:10000/tcp"
restart: "always"
relay:
<<: *image
environment:
TZ: "Europe/Zurich"
NB_LISTEN_ADDRESS: ":33080"
NB_EXPOSED_ADDRESS: "rels://${NETBIRD_FQDN}:443"
NB_AUTH_SECRET: ${NETBIRD_RELAY_SECRET}
entrypoint: ["/usr/local/bin/relay"]
networks:
frontend:
ports:
- "33080:33080/tcp"
restart: "always"
volumes:
management.etc:
management.var:
dashboard.var:
signal.var:
db.etc:
db.var:
db.backup:
networks:
frontend:
backend:
internal: true
```
# DEFAULT SETTINGS 🗃️
| Parameter | Value | Description |
| --- | --- | --- |
| `user` | docker | user name |
| `uid` | 1000 | [user identifier](https://en.wikipedia.org/wiki/User_identifier) |
| `gid` | 1000 | [group identifier](https://en.wikipedia.org/wiki/Group_identifier) |
| `home` | /netbird | home directory of user docker |
# ENVIRONMENT 📝
| Parameter | Value | Default |
| --- | --- | --- |
| `TZ` | [Time Zone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) | |
| `DEBUG` | Will activate debug option for container image and app (if available) | |
# MAIN TAGS 🏷️
These are the main tags for the image. There is also a tag for each commit and its shorthand sha256 value.
* [0.52.2](https://hub.docker.com/r/11notes/netbird/tags?name=0.52.2)
### There is no latest tag, what am I supposed to do about updates?
It is of my opinion that the ```:latest``` tag is dangerous. Many times, Ive introduced **breaking** changes to my images. This would have messed up everything for some people. If you dont want to change the tag to the latest [semver](https://semver.org/), simply use the short versions of [semver](https://semver.org/). Instead of using ```:0.52.2``` you can use ```:0``` or ```:0.52```. Since on each new version these tags are updated to the latest version of the software, using them is identical to using ```:latest``` but at least fixed to a major or minor version.
If you still insist on having the bleeding edge release of this app, simply use the ```:rolling``` tag, but be warned! You will get the latest version of the app instantly, regardless of breaking changes or security issues or what so ever. You do this at your own risk!
# REGISTRIES ☁️
```
docker pull 11notes/netbird:0.52.2
docker pull ghcr.io/11notes/netbird:0.52.2
docker pull quay.io/11notes/netbird:0.52.2
```
# SOURCE 💾
* [11notes/netbird](https://github.com/11notes/docker-NETBIRD)
# PARENT IMAGE 🏛️
> [!IMPORTANT]
>This image is not based on another image but uses [scratch](https://hub.docker.com/_/scratch) as the starting layer.
>The image consists of the following distroless layers that were added:
>* [11notes/distroless:curl](https://github.com/11notes/docker-distroless/blob/master/curl.dockerfile) - app to execute HTTP requests
>* 11notes/distroless:nginx
# BUILT WITH 🧰
* [netbirdio/netbird](https://github.com/netbirdio/netbird)
# GENERAL TIPS 📌
> [!TIP]
>* Use a reverse proxy like Traefik, Nginx, HAproxy to terminate TLS and to protect your endpoints
>* Use Lets Encrypt DNS-01 challenge to obtain valid SSL certificates for your services
# CAUTION ⚠️
> [!CAUTION]
>* Because this image is distroless, it only works with PostgreSQL, **not SQLite**. The GeoLocation middleware is also disabled because of this!
# ElevenNotes™
This image is provided to you at your own risk. Always make backups before updating an image to a different version. Check the [releases](https://github.com/11notes/docker-netbird/releases) for breaking changes. If you have any problems with using this image simply raise an [issue](https://github.com/11notes/docker-netbird/issues), thanks. If you have a question or inputs please create a new [discussion](https://github.com/11notes/docker-netbird/discussions) instead of an issue. You can find all my other repositories on [github](https://github.com/11notes?tab=repositories).
*created 31.07.2025, 09:02:52 (CET)*

View File

@@ -4,7 +4,9 @@
# GLOBAL
ARG APP_UID=1000 \
APP_GID=1000 \
BUILD_ROOT="/go/netbird/management /go/netbird/relay /go/netbird/signal"
BUILD_SRC=https://github.com/netbirdio/netbird.git \
BUILD_ROOT="/go/netbird/management /go/netbird/relay /go/netbird/signal" \
GO_VERSION=1.24
# :: FOREIGN IMAGES
FROM 11notes/nginx:stable AS distroless-nginx
@@ -15,77 +17,51 @@
# ║ BUILD ║
# ╚═════════════════════════════════════════════════════╝
# :: netbird
FROM golang:1.24-alpine AS build
COPY --from=util /usr/local/bin /usr/local/bin
FROM 11notes/go:${GO_VERSION} AS build
ARG APP_VERSION \
BUILD_ROOT \
BUILD_BIN
ENV CGO_ENABLED=0
BUILD_SRC \
BUILD_ROOT
RUN set -ex; \
apk --update --no-cache add \
build-base \
upx \
git;
git clone ${BUILD_SRC} -b v${APP_VERSION}; \
sed -i 's/"development"/"v'${APP_VERSION}'"/' /go/netbird/version/version.go;
RUN set -ex; \
git clone https://github.com/netbirdio/netbird -b v${APP_VERSION};
RUN set -ex; \
mkdir -p /distroless/usr/local/bin; \
for BUILD in ${BUILD_ROOT}; do \
cd ${BUILD}; \
BIN="${BUILD}/$(echo ${BUILD} | awk -F '/' '{print $4}')"; \
go build -ldflags="-extldflags=-static" -o ${BIN} main.go; \
eleven checkStatic ${BIN}; \
eleven strip ${BIN}; \
cp ${BIN} /distroless/usr/local/bin; \
BUILD_BIN="${BUILD}/$(echo ${BUILD} | awk -F '/' '{print $4}')"; \
go mod tidy; \
eleven go build ${BUILD_BIN} main.go; \
eleven distroless ${BUILD_BIN}; \
done; \
mv /distroless/usr/local/bin/management /distroless/usr/local/bin/netbird;
# :: management
FROM golang:1.24-alpine AS management
COPY --from=util /usr/local/bin /usr/local/bin
FROM 11notes/go:${GO_VERSION} AS management
COPY ./build/go/management /go/management
ENV CGO_ENABLED=0
ARG BIN=/go/management/management
RUN set -ex; \
apk --update --no-cache add \
build-base \
upx;
ARG BUILD_BIN=/go/management/management
RUN set -ex; \
cd /go/management; \
go build -ldflags="-extldflags=-static" -o ${BIN} main.go; \
mkdir -p /distroless/usr/local/bin; \
eleven checkStatic ${BIN}; \
eleven strip ${BIN}; \
cp ${BIN} /distroless/usr/local/bin;
eleven go build ${BUILD_BIN} main.go; \
eleven distroless ${BUILD_BIN};
# :: dashboard
FROM golang:1.24-alpine AS dashboard
COPY --from=util /usr/local/bin /usr/local/bin
FROM 11notes/go:${GO_VERSION} AS dashboard
COPY ./build/go/dashboard /go/dashboard
ENV CGO_ENABLED=0
ARG BIN=/go/dashboard/dashboard
ARG BUILD_BIN=/go/dashboard/dashboard
RUN set -ex; \
apk --update --no-cache add \
build-base \
upx \
git \
nodejs \
npm;
RUN set -ex; \
cd /go/dashboard; \
go build -ldflags="-extldflags=-static" -o ${BIN} main.go; \
mkdir -p /distroless/usr/local/bin; \
eleven checkStatic ${BIN}; \
eleven strip ${BIN}; \
cp ${BIN} /distroless/usr/local/bin;
eleven go build ${BUILD_BIN} main.go; \
eleven distroless ${BUILD_BIN};
RUN set -ex; \
git clone https://github.com/netbirdio/dashboard /dashboard;
@@ -100,7 +76,7 @@
# :: file system
FROM alpine AS file-system
COPY --from=util /usr/local/bin /usr/local/bin
COPY --from=util / /
ARG APP_ROOT
USER root

View File

@@ -1,4 +1,9 @@
name: "netbird"
x-image-netbird: &image
image: "11notes/netbird:0.52.2"
read_only: true
services:
db:
image: "11notes/postgres:16"
@@ -6,35 +11,22 @@ services:
environment:
TZ: "Europe/Zurich"
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
# make a full and compressed database backup each day at 03:00
POSTGRES_BACKUP_SCHEDULE: "0 3 * * *"
volumes:
- "db.etc:/postgres/etc"
- "db.var:/postgres/var"
- "db.backup:/postgres/backup"
- "db.cmd:/run/cmd"
tmpfs:
- "/run/postgresql:uid=1000,gid=1000"
# needed for read-only
- "/postgres/run:uid=1000,gid=1000"
- "/postgres/log:uid=1000,gid=1000"
networks:
backend:
restart: "always"
cron:
depends_on:
db:
condition: "service_healthy"
restart: true
image: "11notes/cron:4.6"
environment:
TZ: "Europe/Zurich"
CRONTAB: |-
0 3 * * * cmd-socket '{"bin":"backup"}' > /proc/1/fd/1
volumes:
- "db.cmd:/run/cmd"
restart: "always"
dashboard:
image: "11notes/netbird:0.46.0"
read_only: true
<<: *image
environment:
NETBIRD_MGMT_API_ENDPOINT: "https://${NETBIRD_FQDN}"
NETBIRD_MGMT_GRPC_API_ENDPOINT: "https://${NETBIRD_FQDN}"
@@ -67,8 +59,7 @@ services:
db:
condition: "service_healthy"
restart: true
image: "11notes/netbird:0.46.0"
read_only: true
<<: *image
env_file: '.env'
environment:
TZ: "Europe/Zurich"
@@ -95,7 +86,7 @@ services:
restart: "always"
signal:
image: "11notes/netbird:0.46.0"
<<: *image
environment:
TZ: "Europe/Zurich"
entrypoint: ["/usr/local/bin/signal"]
@@ -113,7 +104,7 @@ services:
restart: "always"
relay:
image: "11notes/netbird:0.46.0"
<<: *image
environment:
TZ: "Europe/Zurich"
NB_LISTEN_ADDRESS: ":33080"
@@ -134,7 +125,6 @@ volumes:
db.etc:
db.var:
db.backup:
db.cmd:
networks:
frontend:

View File

@@ -1,14 +1,20 @@
${{ content_synopsis }} This image will run netbird from a single image (not multiple) rootless and distroless for more security. Due to the nature of a single image and not multiple, you see in the [compose.yaml](https://github.com/11notes/docker-netbird/blob/master/compose.yaml) example that an ```entrypoint:``` has been defined. This image also needs some environment variables present in your **.env** file. This image's defaults (management.json) as well as the example **.env** are to be used with Keycloak as your IdP and Traefik as your reverse proxy. You can however provide your own **management.json** file and use any IdP you like and use a different reverse proxy.
${{ content_synopsis }} This image will run netbird from a single image (not multiple) [rootless](https://github.com/11notes/RTFM/blob/main/linux/container/image/rootless.md) and [distroless](https://github.com/11notes/RTFM/blob/main/linux/container/image/distroless.md) for more security. Due to the nature of a single image and not multiple, you see in the [compose.yaml](https://github.com/11notes/docker-netbird/blob/master/compose.yaml) example that an ```entrypoint:``` has been defined for each service. This image also needs some environment variables present in your **.env** file. This image's defaults (management.json) as well as the example **.env** are to be used with Keycloak as your IdP and Traefik as your reverse proxy. You can however provide your own **management.json** file and use any IdP you like and use a different reverse proxy.
The init binary **management** will replace all variables in the format ```${VARIABLE}``` with all environment variables present in the service.
${{ content_uvp }} Good question! Because ...
${{ github:> [!IMPORTANT] }}
${{ github:> }}* This image runs as 1000:1000 by default, most other images run everything as root
${{ github:> }}* This image has no shell since it is distroless, most other images run on a distro like Debian or Alpine with full shell access (security)
${{ github:> }}* This image does not ship with any critical or high rated CVE and is automatically maintained via CI/CD, most other images mostly have no CVE scanning or code quality tools in place
${{ github:> }}* This image is created via a secure, pinned CI/CD process and immune to upstream attacks, most other images have upstream dependencies that can be exploited
${{ github:> }}* This image works as read-only, most other images need to write files to the image filesystem
${{ github:> }}* This image is a lot smaller than most other images
${{ github:> }}* ... this image runs [rootless](https://github.com/11notes/RTFM/blob/main/linux/container/image/rootless.md) as 1000:1000
${{ github:> }}* ... this image has no shell since it is [distroless](https://github.com/11notes/RTFM/blob/main/linux/container/image/distroless.md)
${{ github:> }}* ... this image is auto updated to the latest version via CI/CD
${{ github:> }}* ... this image has a health check
${{ github:> }}* ... this image runs read-only
${{ github:> }}* ... this image is automatically scanned for CVEs before and after publishing
${{ github:> }}* ... this image is created via a secure and pinned CI/CD process
${{ github:> }}* ... this image is very small
If you value security, simplicity and the ability to interact with the maintainer and developer of an image. Using my images is a great start in that direction.
If you value security, simplicity and optimizations to the extreme, then this image might be for you.
# COMPARISON 🏁
Below you find a comparison between this image and the most used or original one.
@@ -22,7 +28,7 @@ Below you find a comparison between this image and the most used or original one
${{ title_volumes }}
* **${{ json_root }}/etc** - Directory of your management.json config
* **${{ json_root }}/var** - Directory of dynamic data from differnet init systems (relay, signal, management)
* **${{ json_root }}/var** - Directory of dynamic data from different init systems (relay, signal, management)
# EXAMPLE ENV FILE 📑
```ini
@@ -61,4 +67,4 @@ ${{ content_tips }}
${{ title_caution }}
${{ github:> [!CAUTION] }}
${{ github:> }}* Because this image is distroless, it only works with PostgreSQL, not SQLite. The GeoLocation middleware is also disabled because of this!
${{ github:> }}* Because this image is distroless, it only works with PostgreSQL, **not SQLite**. The GeoLocation middleware is also disabled because of this!