Fix docker builds

This commit is contained in:
Zef Hemel
2026-02-06 14:49:20 +01:00
parent c199aba3d8
commit dcf4f126e6
5 changed files with 65 additions and 6 deletions
+16 -3
View File
@@ -9,7 +9,7 @@ on:
- "*"
env:
# Docker & Registries
ARCHITECTURES: linux/amd64,linux/arm64
ARCHITECTURES: linux/arm64,linux/amd64
IMAGE_NAME: silverbullet
WEBSITE_IMAGE: zefhemel/silverbullet-website
NAMESPACE_GITHUB: silverbulletmd
@@ -48,6 +48,19 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Deno
uses: denoland/setup-deno@v2
with:
deno-version: v2.6.8
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: "1.25.1"
- name: Build binaries for multiple platforms
run: |
make build-for-docker
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4.4.0
@@ -67,12 +80,12 @@ jobs:
type=raw,value=v2,enable=${{ github.ref == 'refs/heads/main' }}
- name: Build and push main docker images
uses: docker/build-push-action@v4.0.0
uses: docker/build-push-action@v6.18.0
with:
context: .
platforms: ${{ env.ARCHITECTURES }}
push: true
file: Dockerfile
file: Dockerfile.ci
provenance: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
+1 -1
View File
@@ -31,7 +31,7 @@ VOLUME /space
# Or simply mount an existing folder into the container:
# docker run -v /path/to/my/folder:/space -p3000:3000 -it ghcr.io/silverbulletmd/silverbullet
RUN apk add --no-cache git curl bash tini
RUN apk add --no-cache git curl bash tini libc6-compat
HEALTHCHECK CMD curl --fail http://localhost:$SB_PORT$SB_URL_PREFIX/.ping || exit 1
+39
View File
@@ -0,0 +1,39 @@
FROM alpine:latest
# The volume that will keep the space data
VOLUME /space
ARG TARGETARCH
# Either create a volume:
# docker volume create myspace
# Then bind-mount it when running the container with the -v flag, e.g.:
# docker run -v myspace:/space -p3000:3000 -it ghcr.io/silverbulletmd/silverbullet
# Or simply mount an existing folder into the container:
# docker run -v /path/to/my/folder:/space -p3000:3000 -it ghcr.io/silverbulletmd/silverbullet
RUN apk add --no-cache git curl bash tini libc6-compat
HEALTHCHECK CMD curl --fail http://localhost:$SB_PORT$SB_URL_PREFIX/.ping || exit 1
# Expose port 3000
# Port map this when running, e.g. with -p 3002:3000 (where 3002 is the host port)
EXPOSE 3000
# Always binding to this IP, otherwise the server wouldn't be available
ENV SB_HOSTNAME=0.0.0.0
ENV SB_FOLDER=/space
ENV SB_PORT=3000
# Reset /etc/group and /etc/passwd
RUN echo "" > /etc/group && echo "root:x:0:0:root:/root:/bin/sh" > /etc/passwd
# As well as the docker-entrypoint.sh script
ADD ./docker-entrypoint.sh /docker-entrypoint.sh
# Copy the bundled version of silverbullet into the container
ADD silverbullet-${TARGETARCH} /silverbullet
# Run the server, allowing to pass in additional argument at run time, e.g.
# docker run -p 3002:3000 -v myspace:/space -it ghcr.io/silverbulletmd/silverbullet --user me:letmein
ENTRYPOINT ["/sbin/tini", "--", "/docker-entrypoint.sh"]
+8 -1
View File
@@ -6,9 +6,16 @@ build:
# Build server
go build
build-for-docker: build
GOOS=linux GOARCH=arm64 go build -o silverbullet-arm64 .
GOOS=linux GOARCH=amd64 go build -o silverbullet-amd64 .
docker: build-for-docker
docker buildx build --platform linux/arm64,linux/amd64 --push .
clean:
rm -rf client_bundle/{base_fs,client} dist public_version.ts
rm -f silverbullet
rm -f silverbullet silverbullet-arm64 silverbullet-amd64
check:
# Frontend type check
+1 -1
View File
@@ -205,7 +205,7 @@ export async function indexLinks(
if (alias) {
link.alias = alias;
}
updateITags(link as LinkObject, frontmatter);
updateITags(link, frontmatter);
objects.push(link);
}
}