Skip to content

Commit 9038db2

Browse files
committed
Docker builds
1 parent e35edaa commit 9038db2

File tree

4 files changed

+18
-7
lines changed

4 files changed

+18
-7
lines changed

.github/workflows/docker.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches:
66
- "main"
7+
- "go-backend"
78
tags:
89
- "*"
910
env:
@@ -62,7 +63,7 @@ jobs:
6263
# When pushing to main branch, release as :edge DISABLED FOR NOW
6364
# type=edge,branch=main
6465
# When pushing to main branch, release as :v2
65-
type=raw,value=v2,enable=${{ github.ref == 'refs/heads/main' }}
66+
type=raw,value=v2-go,enable=${{ github.ref == 'refs/heads/go-backend' }}
6667
6768
- name: Build and push main docker images
6869
uses: docker/[email protected]

Dockerfile

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
1-
21
# Stage 1: Build the silverbullet binary
32
FROM denoland/deno:2.5.0 AS builder
4-
RUN apt update && apt install -y git
3+
RUN apt update && apt install -y git wget
4+
5+
ARG TARGETARCH
6+
ENV GO_VERSION=1.25.1
7+
8+
RUN wget -P /tmp "https://dl.google.com/go/go${GO_VERSION}.linux-${TARGETARCH}.tar.gz"
9+
RUN tar -C /usr/local -xzf "/tmp/go${GO_VERSION}.linux-${TARGETARCH}.tar.gz"
10+
11+
ENV GOPATH=/go
12+
ENV PATH=$GOPATH/bin:/usr/local/go/bin:$PATH
13+
514
WORKDIR /app
615
ADD . /app
716

817
# This will produce the `silverbullet` self-contained binary in /app/silverbullet
918
RUN deno task build
19+
RUN go build
1020

1121
# Stage 2: Create the runtime from the build
1222
FROM ubuntu:noble

deno.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@silverbulletmd/silverbullet",
33
"version": "2.0.0",
44
"tasks": {
5-
"build": "rm -rf dist dist_client_bundle dist_plug_bundle && deno run -A build_plugs.ts && deno run -A build_web.ts --production && deno task compile",
5+
"build": "rm -rf dist dist_client_bundle dist_plug_bundle && deno run -A build_plugs.ts && deno run -A build_web.ts --production",
66
"clean": "rm -rf dist dist_client_bundle dist_plug_bundle",
77
"deep-clean-mac": "rm -f deno.lock && rm -rf $HOME/Library/Caches/deno && deno task clean",
88
"install": "deno install -g -f -A --import-map deno.json silverbullet.ts",

pkg/server/cmd/server.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,10 @@ func buildConfig(bundledFiles fs.FS, args []string) *server.ServerConfig {
3939
if len(args) > 0 {
4040
serverConfig.SpaceFolderPath = args[0]
4141
}
42-
if os.Getenv("SB_FOLDER_PATH") != "" {
43-
serverConfig.SpaceFolderPath = os.Getenv("SB_FOLDER_PATH")
42+
if os.Getenv("SB_FOLDER") != "" {
43+
serverConfig.SpaceFolderPath = os.Getenv("SB_FOLDER")
4444
}
45+
4546
if serverConfig.SpaceFolderPath == "" {
4647
log.Fatal("No folder specified. Please pass a folder as an argument or set SB_FOLDER environment variable.")
4748
}
@@ -144,7 +145,6 @@ func ServerCommand(bundledFiles fs.FS) *cobra.Command {
144145
var c = &cobra.Command{
145146
Use: "silverbullet [path]",
146147
Short: "Run the Silverbullet server",
147-
Args: cobra.ExactArgs(1),
148148
Run: func(cmd *cobra.Command, args []string) {
149149
serverConfig := buildConfig(bundledFiles, args)
150150
if err := server.RunServer(serverConfig); err != nil {

0 commit comments

Comments
 (0)