mirror of https://github.com/Xhofe/alist
✨ dockerfile volume
parent
7799c1f3bc
commit
65ec4e3611
|
@ -24,4 +24,5 @@ bin/*
|
|||
alist
|
||||
*.json
|
||||
public/index.html
|
||||
public/assets/
|
||||
public/assets/
|
||||
data/
|
|
@ -7,6 +7,7 @@ RUN apk add --no-cache bash git go gcc musl-dev; \
|
|||
|
||||
FROM alpine:edge
|
||||
LABEL MAINTAINER="i@nn.ci"
|
||||
VOLUME /opt/alist/data/
|
||||
WORKDIR /opt/alist/
|
||||
COPY --from=builder /app/bin/alist ./
|
||||
EXPOSE 5244
|
||||
|
|
2
alist.go
2
alist.go
|
@ -14,7 +14,7 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
flag.StringVar(&conf.ConfigFile, "conf", "config.json", "config file")
|
||||
flag.StringVar(&conf.ConfigFile, "conf", "data/config.json", "config file")
|
||||
flag.BoolVar(&conf.Debug, "debug", false, "start with debug mode")
|
||||
flag.BoolVar(&conf.Version, "version", false, "print version info")
|
||||
flag.Parse()
|
||||
|
|
|
@ -13,6 +13,10 @@ func InitConf() {
|
|||
log.Infof("reading config file: %s", conf.ConfigFile)
|
||||
if !utils.Exists(conf.ConfigFile) {
|
||||
log.Infof("config file not exists, creating default config file")
|
||||
_, err := utils.CreatNestedFile(conf.ConfigFile)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to create config file")
|
||||
}
|
||||
conf.Conf = conf.DefaultConfig()
|
||||
if !utils.WriteToJson(conf.ConfigFile, conf.Conf) {
|
||||
log.Fatalf("failed to create default config file")
|
||||
|
|
|
@ -28,7 +28,7 @@ func DefaultConfig() *Config {
|
|||
Port: 0,
|
||||
Name: "",
|
||||
TablePrefix: "x_",
|
||||
DBFile: "data.db",
|
||||
DBFile: "data/data.db",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue