Skip to content

Commit f51af7b

Browse files
committed
Work on release builds
1 parent 839860a commit f51af7b

File tree

9 files changed

+71
-57
lines changed

9 files changed

+71
-57
lines changed

.github/workflows/docker.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ jobs:
4242
run: |
4343
deno task build
4444
deno task bundle
45+
deno task compile server:dist:linux-x86_64 && mv silverbullet silverbullet-amd64
46+
deno task compile server:dist:linux-aarch64 && mv silverbullet silverbullet-arm64
4547
4648
- name: Login to Docker Hub
4749
uses: docker/login-action@v2

.github/workflows/edge.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Build & Release Edge
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
jobs:
8+
release:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Setup repo
12+
uses: actions/checkout@v3
13+
- name: Setup Deno
14+
uses: denoland/setup-deno@v2
15+
with:
16+
deno-version: v2.3.5
17+
- name: Compile for all platforms
18+
run: |
19+
deno task server:zip:linux-x86_64
20+
deno task server:zip:linux-aarch64
21+
deno task server:zip:darwin-x86_64
22+
deno task server:zip:darwin-aarch64
23+
deno task server:zip:windows-x86_64
24+
- name: Update edge release
25+
uses: softprops/action-gh-release@v1
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
with:
29+
draft: false
30+
tag_name: edge
31+
body: Automated build from commit ${{ github.sha }}
32+
prerelease: false
33+
files: |
34+
website/CHANGELOG.md
35+
dist/silverbullet.js
36+
silverbullet-*.zip

.github/workflows/server.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ jobs:
2727
2828
- name: Compile for all platforms
2929
run: |
30-
deno task server:dist:linux-x86_64
31-
deno task server:dist:linux-aarch64
32-
deno task server:dist:darwin-x86_64
33-
deno task server:dist:darwin-aarch64
34-
deno task server:dist:windows-x86_64
30+
deno task server:zip:linux-x86_64
31+
deno task server:zip:linux-aarch64
32+
deno task server:zip:darwin-x86_64
33+
deno task server:zip:darwin-aarch64
34+
deno task server:zip:windows-x86_64
3535
3636
- name: Release
3737
uses: softprops/action-gh-release@v1

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ node_modules
1212
*.db*
1313
test_space
1414
silverbullet
15+
silverbullet-*
1516
deploy.json
1617
*.generated
1718
tmp_playground

Dockerfile

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM denoland/deno:debian-2.3.5
1+
FROM denoland/deno:alpine-2.3.5
22

33
# The volume that will keep the space data
44

@@ -14,44 +14,29 @@ VOLUME /space
1414
# Accept TARGETARCH as argument
1515
ARG TARGETARCH
1616

17-
# Adding tini manually, as it's not included anymore in the new baseimage
18-
ENV TINI_VERSION v0.19.0
17+
# Adding tini
18+
ENV TINI_VERSION=v0.19.0
1919
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${TARGETARCH} /tini
2020

2121
# Make sure the deno user has access to the space volume
2222
RUN mkdir -p -m 777 /space \
2323
&& chmod +x /tini \
24-
&& apt update \
25-
&& apt install -y git ssh-client pandoc texlive \
26-
&& echo "**** cleanup ****" \
27-
&& apt-get -y autoremove \
28-
&& apt-get clean \
29-
&& mkdir -p /deno-dir \
30-
&& chmod 777 /deno-dir \
31-
&& rm -rf \
32-
/tmp/* \
33-
/var/lib/apt/lists/* \
34-
/var/tmp/* \
35-
/var/log/* \
36-
/usr/share/man
37-
24+
&& apk add bash
3825

3926
# Expose port 3000
4027
# Port map this when running, e.g. with -p 3002:3000 (where 3002 is the host port)
4128
EXPOSE 3000
4229

4330
# Always binding to this IP, otherwise the server wouldn't be available
44-
ENV SB_HOSTNAME 0.0.0.0
45-
ENV SB_FOLDER /space
46-
47-
# Copy the bundled version of silverbullet into the container
48-
ADD ./dist/silverbullet.js /silverbullet.js
49-
# Precache any remaining dependencies
50-
RUN deno cache /silverbullet.js
31+
ENV SB_HOSTNAME=0.0.0.0
32+
ENV SB_FOLDER=/space
5133

5234
# As well as the docker-entrypoint.sh script
5335
ADD ./docker-entrypoint.sh /docker-entrypoint.sh
5436

37+
# Copy the bundled version of silverbullet into the container
38+
ADD silverbullet-${TARGETARCH} /silverbullet
39+
5540
# Run the server, allowing to pass in additional argument at run time, e.g.
5641
# docker run -p 3002:3000 -v myspace:/space -it ghcr.io/silverbulletmd/silverbullet --user me:letmein
5742
ENTRYPOINT ["/tini", "--", "/docker-entrypoint.sh"]

deno.json

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,18 @@
3333
"deep-clean-mac": "rm -f deno.lock && rm -rf $HOME/Library/Caches/deno && deno task clean",
3434

3535
"install": "deno install -g -f -A --import-map deno.json silverbullet.ts",
36-
"install-hooks": "./scripts/install_hooks.sh",
3736

3837
"check": "find . -name '*.ts*' | xargs deno check",
3938
"lint": "deno lint",
4039
"fmt": "deno fmt",
4140
"test": "deno test -A",
4241
"bench": "deno bench",
4342

44-
"build": "rm -rf dist dist_client_bundle dist_plug_bundle && deno run -A build_plugs.ts && deno run -A build_web.ts",
43+
"build": "rm -rf dist dist_client_bundle dist_plug_bundle && deno run -A build_plugs.ts && deno run -A build_web.ts && deno task compile",
4544
"plugs": "deno run -A build_plugs.ts",
4645
"server": "deno run -A --check silverbullet.ts",
4746
"generate": "./scripts/generate.sh",
47+
"docker": "./scripts/build_docker.sh",
4848

4949
"watch-web": "deno run -A --check build_web.ts --watch",
5050
"watch-server": "deno run -A --check --watch silverbullet.ts",
@@ -54,11 +54,17 @@
5454
"bundle": "deno run -A build_bundle.ts",
5555

5656
"compile": "deno task bundle && deno compile -A -o silverbullet dist/silverbullet.js",
57-
"server:dist:linux-x86_64": "deno task bundle && deno compile -A --target x86_64-unknown-linux-gnu -o silverbullet dist/silverbullet.js && zip silverbullet-server-linux-x86_64.zip silverbullet",
58-
"server:dist:linux-aarch64": "deno task bundle && deno compile -A --target aarch64-unknown-linux-gnu -o silverbullet dist/silverbullet.js && zip silverbullet-server-linux-aarch64 silverbullet",
59-
"server:dist:darwin-x86_64": "deno task bundle && deno compile -A --target x86_64-apple-darwin -o silverbullet dist/silverbullet.js && zip silverbullet-server-darwin-x86_64.zip silverbullet",
60-
"server:dist:darwin-aarch64": "deno task bundle && deno compile -A --target aarch64-apple-darwin -o silverbullet dist/silverbullet.js && zip silverbullet-server-darwin-aarch64.zip silverbullet",
61-
"server:dist:windows-x86_64": "deno task bundle && deno compile -A --target x86_64-pc-windows-msvc -o silverbullet.exe dist/silverbullet.js && zip silverbullet-server-windows-x86_64.zip silverbullet.exe"
57+
58+
"server:dist:linux-x86_64": "deno task bundle && deno compile -A --target x86_64-unknown-linux-gnu -o silverbullet dist/silverbullet.js",
59+
"server:zip:linux-x86_64": "deno task server:dist:linux-x86_64 && zip silverbullet-server-linux-x86_64.zip silverbullet",
60+
"server:dist:linux-aarch64": "deno task bundle && deno compile -A --target aarch64-unknown-linux-gnu -o silverbullet dist/silverbullet.js",
61+
"server:zip:linux-aarch64": "deno task server:dist:linux-aarch64 && zip silverbullet-server-linux-aarch64.zip silverbullet",
62+
"server:dist:darwin-x86_64": "deno task bundle && deno compile -A --target x86_64-apple-darwin -o silverbullet dist/silverbullet.js",
63+
"server:zip:darwin-x86_64": "deno task server:dist:darwin-x86_64 && zip silverbullet-server-darwin-x86_64.zip silverbullet",
64+
"server:dist:darwin-aarch64": "deno task bundle && deno compile -A --target aarch64-apple-darwin -o silverbullet dist/silverbullet.js",
65+
"server:zip:darwin-aarch64": "deno task server:dist:darwin-aarch64 && zip silverbullet-server-darwin-aarch64.zip silverbullet",
66+
"server:dist:windows-x86_64": "deno task bundle && deno compile -A --target x86_64-pc-windows-msvc -o silverbullet.exe dist/silverbullet.js",
67+
"server:zip:windows-x86_64": "deno task server:dist:windows-x86_64 && zip silverbullet-server-windows-x86_64.zip silverbullet.exe"
6268
},
6369
"lint": {
6470
"exclude": [

docker-entrypoint.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ fi
1313

1414
if [ "$PUID" == "0" ] || [ "$UID" != "0" ]; then
1515
# Will run SilverBullet as default user
16-
deno run -A /silverbullet.js $@
16+
/silverbullet $@
1717
else
1818
# Create silverbullet user and group ad-hoc mapped to PUID and PGID
1919
getent group $PGID &> /dev/null || groupadd -g $PGID silverbullet
@@ -24,6 +24,6 @@ else
2424
# And run via su as requested PUID, usually this will be 'silverbullet' but if a user with this idea already exists, we will use that
2525
USERNAME=$(getent passwd $PUID | cut -d ":" -f 1)
2626
echo "Running SilverBullet as $USERNAME (configured as PUID $PUID and PGID $PGID)"
27-
su $USERNAME -s /bin/bash -c "deno run -A /silverbullet.js $args"
27+
su $USERNAME -s /bin/bash -c "/silverbullet $args"
2828
fi
2929

scripts/build_docker.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/bin/sh
22

3-
deno task bundle
3+
echo "Building both AMD64 and ARM64 Linux binaries"
4+
deno task server:dist:linux-x86_64 && mv silverbullet silverbullet-amd64
5+
deno task server:dist:linux-aarch64 && mv silverbullet silverbullet-arm64
46
docker build -t silverbullet .

scripts/install_hooks.sh

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)