Skip to content

Commit 6facf4b

Browse files
committed
dockerfile updated due to run exec err
1 parent 2a9b0f1 commit 6facf4b

File tree

3 files changed

+14
-83
lines changed

3 files changed

+14
-83
lines changed

Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@ COPY --from=build-env /src/server /app/
2121

2222
# create user and give it permissions
2323
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
24+
RUN mkdir /app/pb_data
25+
RUN mkdir /app/pb_migrations
26+
RUN mkdir /app/pb_config
27+
2428
RUN chown -R appuser:appgroup /app
2529
USER appuser
2630

27-
ENV CGO_ENABLED=0
28-
ENTRYPOINT ["/app/server"]
31+
CMD ["/app/server","serve", "--http=0.0.0.0:8090"]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,5 +76,5 @@ docker run -d --name postgresbase \
7676
-e DATABASE="postgresql://user:pass@<postgres-ip>:5432/postgres?sslmode=disable" \
7777
-e JWT_PRIVATE_KEY="$(cat $PWD/keys/private.pem)" \
7878
-e JWT_PUBLIC_KEY="$(cat $PWD/keys/public.pem)" \
79-
<your-name>/postgresbase:1.0.0 serve --http=0.0.0.0:8090
79+
<your-name>/postgresbase:1.0.0
8080
```

examples/base/main.go

Lines changed: 8 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,10 @@ package main
33
import (
44
"log"
55
"os"
6-
"path/filepath"
7-
"strings"
86
"time"
97

108
"github.com/pocketbase/pocketbase"
11-
"github.com/pocketbase/pocketbase/apis"
129
"github.com/pocketbase/pocketbase/core"
13-
"github.com/pocketbase/pocketbase/plugins/ghupdate"
14-
"github.com/pocketbase/pocketbase/plugins/jsvm"
1510
"github.com/pocketbase/pocketbase/plugins/migratecmd"
1611
)
1712

@@ -21,39 +16,6 @@ func main() {
2116
// ---------------------------------------------------------------
2217
// Optional plugin flags:
2318
// ---------------------------------------------------------------
24-
25-
var hooksDir string
26-
app.RootCmd.PersistentFlags().StringVar(
27-
&hooksDir,
28-
"hooksDir",
29-
"",
30-
"the directory with the JS app hooks",
31-
)
32-
33-
var hooksWatch bool
34-
app.RootCmd.PersistentFlags().BoolVar(
35-
&hooksWatch,
36-
"hooksWatch",
37-
true,
38-
"auto restart the app on pb_hooks file change",
39-
)
40-
41-
var hooksPool int
42-
app.RootCmd.PersistentFlags().IntVar(
43-
&hooksPool,
44-
"hooksPool",
45-
25,
46-
"the total prewarm goja.Runtime instances for the JS app hooks execution",
47-
)
48-
49-
var migrationsDir string
50-
app.RootCmd.PersistentFlags().StringVar(
51-
&migrationsDir,
52-
"migrationsDir",
53-
"",
54-
"the directory with the user defined migrations",
55-
)
56-
5719
var automigrate bool
5820
app.RootCmd.PersistentFlags().BoolVar(
5921
&automigrate,
@@ -62,22 +24,6 @@ func main() {
6224
"enable/disable auto migrations",
6325
)
6426

65-
var publicDir string
66-
app.RootCmd.PersistentFlags().StringVar(
67-
&publicDir,
68-
"publicDir",
69-
defaultPublicDir(),
70-
"the directory to serve static files",
71-
)
72-
73-
var indexFallback bool
74-
app.RootCmd.PersistentFlags().BoolVar(
75-
&indexFallback,
76-
"indexFallback",
77-
true,
78-
"fallback the request to index.html on missing static path (eg. when pretty urls are used with SPA)",
79-
)
80-
8127
var queryTimeout int
8228
app.RootCmd.PersistentFlags().IntVar(
8329
&queryTimeout,
@@ -92,46 +38,28 @@ func main() {
9238
// Plugins and hooks:
9339
// ---------------------------------------------------------------
9440

95-
// load jsvm (hooks and migrations)
96-
jsvm.MustRegister(app, jsvm.Config{
97-
MigrationsDir: migrationsDir,
98-
HooksDir: hooksDir,
99-
HooksWatch: hooksWatch,
100-
HooksPoolSize: hooksPool,
101-
})
102-
10341
// migrate command (with js templates)
10442
migratecmd.MustRegister(app, app.RootCmd, migratecmd.Config{
10543
TemplateLang: migratecmd.TemplateLangJS,
10644
Automigrate: automigrate,
107-
Dir: migrationsDir,
45+
// Dir: migrationsDir,
10846
})
10947

110-
// GitHub selfupdate
111-
ghupdate.MustRegister(app, app.RootCmd, ghupdate.Config{})
48+
// // GitHub selfupdate
49+
// ghupdate.MustRegister(app, app.RootCmd, ghupdate.Config{})
11250

11351
app.OnAfterBootstrap().PreAdd(func(e *core.BootstrapEvent) error {
11452
app.Dao().ModelQueryTimeout = time.Duration(queryTimeout) * time.Second
11553
return nil
11654
})
11755

118-
app.OnBeforeServe().Add(func(e *core.ServeEvent) error {
119-
// serves static files from the provided public dir (if exists)
120-
e.Router.GET("/*", apis.StaticDirectoryHandler(os.DirFS(publicDir), indexFallback))
121-
return nil
122-
})
56+
// app.OnBeforeServe().Add(func(e *core.ServeEvent) error {
57+
// // serves static files from the provided public dir (if exists)
58+
// e.Router.GET("/*", apis.StaticDirectoryHandler(os.DirFS(publicDir), indexFallback))
59+
// return nil
60+
// })
12361

12462
if err := app.Start(); err != nil {
12563
log.Fatal(err)
12664
}
12765
}
128-
129-
// the default pb_public dir location is relative to the executable
130-
func defaultPublicDir() string {
131-
if strings.HasPrefix(os.Args[0], os.TempDir()) {
132-
// most likely ran with go run
133-
return "./pb_public"
134-
}
135-
136-
return filepath.Join(os.Args[0], "../pb_public")
137-
}

0 commit comments

Comments
 (0)