-14
.dockerignore
-14
.dockerignore
+5
-4
Dockerfile
+5
-4
Dockerfile
···
3
3
WORKDIR /build
4
4
COPY go.mod go.sum ./
5
5
RUN go mod download
6
-
COPY . .
6
+
COPY main.go ./
7
+
COPY internal/ ./internal/
7
8
ARG SMALLWEB_VERSION=dev
8
9
RUN go build -ldflags="-s -w -X github.com/pomdtr/smallweb/build.Version=${SMALLWEB_VERSION}" -o smallweb
9
10
···
40
41
EXPOSE 7777
41
42
42
43
# Add entrypoint script
43
-
COPY entrypoint.sh /entrypoint.sh
44
-
RUN chmod +x /entrypoint.sh
44
+
COPY docker-entrypoint.sh /docker-entrypoint.sh
45
+
RUN chmod +x /docker-entrypoint.sh
45
46
46
-
ENTRYPOINT ["/entrypoint.sh"]
47
+
ENTRYPOINT ["/docker-entrypoint.sh"]
47
48
CMD ["up", "--enable-crons", "--addr", ":7777"]
+1
-1
app/app.go
internal/app/app.go
+1
-1
app/app.go
internal/app/app.go
build/build.go
internal/build/build.go
build/build.go
internal/build/build.go
cmd/config.go
internal/cmd/config.go
cmd/config.go
internal/cmd/config.go
+2
-2
cmd/crons.go
internal/cmd/crons.go
+2
-2
cmd/crons.go
internal/cmd/crons.go
···
13
13
14
14
"github.com/cli/go-gh/v2/pkg/tableprinter"
15
15
"github.com/mattn/go-isatty"
16
-
"github.com/pomdtr/smallweb/app"
17
-
"github.com/pomdtr/smallweb/worker"
16
+
"github.com/pomdtr/smallweb/internal/app"
17
+
"github.com/pomdtr/smallweb/internal/worker"
18
18
"github.com/robfig/cron/v3"
19
19
"github.com/spf13/cobra"
20
20
"golang.org/x/term"
cmd/docs.go
internal/cmd/docs.go
cmd/docs.go
internal/cmd/docs.go
+1
-1
cmd/doctor.go
internal/cmd/doctor.go
+1
-1
cmd/doctor.go
internal/cmd/doctor.go
cmd/git.go
internal/cmd/git.go
cmd/git.go
internal/cmd/git.go
cmd/init.go
internal/cmd/init.go
cmd/init.go
internal/cmd/init.go
cmd/link.go
internal/cmd/link.go
cmd/link.go
internal/cmd/link.go
+1
-1
cmd/list.go
internal/cmd/list.go
+1
-1
cmd/list.go
internal/cmd/list.go
+1
-1
cmd/open.go
internal/cmd/open.go
+1
-1
cmd/open.go
internal/cmd/open.go
+3
-3
cmd/root.go
internal/cmd/root.go
+3
-3
cmd/root.go
internal/cmd/root.go
···
14
14
"github.com/knadh/koanf/providers/posflag"
15
15
"github.com/knadh/koanf/v2"
16
16
17
-
"github.com/pomdtr/smallweb/app"
18
-
"github.com/pomdtr/smallweb/build"
19
-
"github.com/pomdtr/smallweb/utils"
17
+
"github.com/pomdtr/smallweb/internal/app"
18
+
"github.com/pomdtr/smallweb/internal/build"
19
+
"github.com/pomdtr/smallweb/internal/utils"
20
20
"github.com/spf13/cobra"
21
21
)
22
22
+2
-2
cmd/run.go
internal/cmd/run.go
+2
-2
cmd/run.go
internal/cmd/run.go
cmd/secrets.go
internal/cmd/secrets.go
cmd/secrets.go
internal/cmd/secrets.go
cmd/templates/workspace/.gitignore
internal/cmd/templates/workspace/.gitignore
cmd/templates/workspace/.gitignore
internal/cmd/templates/workspace/.gitignore
cmd/templates/workspace/.smallweb/config.tmpl.json
internal/cmd/templates/workspace/.smallweb/config.tmpl.json
cmd/templates/workspace/.smallweb/config.tmpl.json
internal/cmd/templates/workspace/.smallweb/config.tmpl.json
cmd/templates/workspace/.vscode/extensions.json
internal/cmd/templates/workspace/.vscode/extensions.json
cmd/templates/workspace/.vscode/extensions.json
internal/cmd/templates/workspace/.vscode/extensions.json
cmd/templates/workspace/.vscode/settings.json
internal/cmd/templates/workspace/.vscode/settings.json
cmd/templates/workspace/.vscode/settings.json
internal/cmd/templates/workspace/.vscode/settings.json
cmd/templates/workspace/example/main.ts
internal/cmd/templates/workspace/example/main.ts
cmd/templates/workspace/example/main.ts
internal/cmd/templates/workspace/example/main.ts
cmd/templates/workspace/www/index.md
internal/cmd/templates/workspace/www/index.md
cmd/templates/workspace/www/index.md
internal/cmd/templates/workspace/www/index.md
+5
-5
cmd/up.go
internal/cmd/up.go
+5
-5
cmd/up.go
internal/cmd/up.go
···
38
38
"github.com/knadh/koanf/providers/posflag"
39
39
"github.com/knadh/koanf/v2"
40
40
41
-
"github.com/pomdtr/smallweb/app"
42
-
"github.com/pomdtr/smallweb/sftp"
43
-
"github.com/pomdtr/smallweb/watcher"
41
+
"github.com/pomdtr/smallweb/internal/app"
42
+
"github.com/pomdtr/smallweb/internal/sftp"
43
+
"github.com/pomdtr/smallweb/internal/watcher"
44
44
gossh "golang.org/x/crypto/ssh"
45
45
"golang.org/x/oauth2"
46
46
47
-
"github.com/pomdtr/smallweb/utils"
48
-
"github.com/pomdtr/smallweb/worker"
47
+
"github.com/pomdtr/smallweb/internal/utils"
48
+
"github.com/pomdtr/smallweb/internal/worker"
49
49
"github.com/spf13/cobra"
50
50
)
51
51
+23
docker-entrypoint.sh
+23
docker-entrypoint.sh
···
1
+
#!/bin/bash
2
+
set -e
3
+
4
+
# Get current UID/GID from environment or use defaults
5
+
USER_ID=${PUID:-$(stat -c '%u' "$SMALLWEB_DIR")}
6
+
GROUP_ID=${PGID:-$(stat -c '%g' "$SMALLWEB_DIR")}
7
+
8
+
if [ "$USER_ID" = "0" ]; then
9
+
exec /usr/local/bin/smallweb "$@"
10
+
fi
11
+
12
+
if [ "$(id -u smallweb)" != "$USER_ID" ]; then
13
+
echo "Updating user 'smallweb' with new UID -> $USER_ID"
14
+
usermod -u "$USER_ID" smallweb
15
+
fi
16
+
17
+
if [ "$(id -g smallweb)" != "$GROUP_ID" ]; then
18
+
echo "Updating group 'smallweb' with new GID -> $GROUP_ID"
19
+
groupmod -g "$GROUP_ID" smallweb
20
+
fi
21
+
22
+
# Execute the command as the smallweb user
23
+
exec gosu smallweb:smallweb /usr/local/bin/smallweb "$@"
-21
entrypoint.sh
-21
entrypoint.sh
···
1
-
#!/bin/bash
2
-
set -e
3
-
4
-
# Get current UID/GID from environment or use defaults
5
-
USER_ID=${PUID:-1000}
6
-
GROUP_ID=${PGID:-1000}
7
-
8
-
echo "Starting with UID: $USER_ID, GID: $GROUP_ID"
9
-
10
-
# Update the user to match desired UID/GID if needed
11
-
if [ "$USER_ID" != "1000" ] || [ "$GROUP_ID" != "1000" ]; then
12
-
echo "Updating user 'smallweb' with new UID:GID -> $USER_ID:$GROUP_ID"
13
-
groupmod -g "$GROUP_ID" smallweb
14
-
usermod -u "$USER_ID" -g "$GROUP_ID" smallweb
15
-
fi
16
-
17
-
# Ensure correct ownership of the application directory
18
-
chown -R smallweb:smallweb /smallweb
19
-
20
-
# Execute the command as the smallweb user
21
-
exec gosu smallweb:smallweb /usr/local/bin/smallweb "$@"
+1
-1
main.go
+1
-1
main.go
sftp/handler.go
internal/sftp/handler.go
sftp/handler.go
internal/sftp/handler.go
sftp/sftp.go
internal/sftp/sftp.go
sftp/sftp.go
internal/sftp/sftp.go
utils/fs.go
internal/utils/fs.go
utils/fs.go
internal/utils/fs.go
utils/hujson.go
internal/utils/hujson.go
utils/hujson.go
internal/utils/hujson.go
utils/path.go
internal/utils/path.go
utils/path.go
internal/utils/path.go
+2
-2
watcher/watcher.go
internal/watcher/watcher.go
+2
-2
watcher/watcher.go
internal/watcher/watcher.go
worker/sandbox.ts
internal/worker/sandbox.ts
worker/sandbox.ts
internal/worker/sandbox.ts
+3
-3
worker/worker.go
internal/worker/worker.go
+3
-3
worker/worker.go
internal/worker/worker.go
···
21
21
22
22
"github.com/adrg/xdg"
23
23
"github.com/gorilla/websocket"
24
-
"github.com/pomdtr/smallweb/app"
25
-
"github.com/pomdtr/smallweb/build"
26
-
"github.com/pomdtr/smallweb/utils"
24
+
"github.com/pomdtr/smallweb/internal/app"
25
+
"github.com/pomdtr/smallweb/internal/build"
26
+
"github.com/pomdtr/smallweb/internal/utils"
27
27
)
28
28
29
29
//go:embed sandbox.ts