feat: db file to data directory

This commit is contained in:
xuthus5 2023-10-22 01:39:43 +08:00
parent 3bb5909053
commit 873e8dfd2b
Signed by: xuthus5
GPG Key ID: A23CF9620CBB55F9
6 changed files with 14 additions and 13 deletions

3
.gitignore vendored
View File

@ -3,4 +3,5 @@ go.sum
pastebin
pastebin.exe
pastebin.exe~
pastebin.db
pastebin.db
data/pastebin.db

View File

@ -4,10 +4,10 @@ COPY ./webui .
RUN npm install && npm run build
FROM images.local/golang:latest
WORKDIR /app
COPY . /app
COPY --from=0 dist /app/webui/dist
RUN go mod tidy && go build .
COPY . .
COPY --from=0 dist ./webui/dist
RUN buf generate && go mod tidy && go build .
EXPOSE 38080
EXPOSE 38081
ENTRYPOINT [ "./pastebin", "api" ]

View File

@ -1,6 +1,6 @@
server-name: pastebin
server-listen: 127.0.0.1:38080
server-listen: 127.0.0.1:38082
environment: dev
db:
dbname: pastebin.db
dbname: data/pastebin.db
debug: true

View File

@ -1,6 +1,6 @@
server-name: pastebin
server-listen: 0.0.0.0:38080
server-listen: 0.0.0.0:38082
environment: prod
db:
dbname: pastebin.db
dbname: data/pastebin.db
debug: true

0
data/.gitkeep Normal file
View File

View File

@ -2,10 +2,10 @@ version: "3"
services:
server:
image: xuthus5/pastebin:latest
image: images.local/pastebin:latest
container_name: pastebin
restart: always
volumes:
- /data/containers/pastebin:/app/data
- /data/containers/pastebin/pastebin.db:/app/pastebin.db
ports:
- "30001:38080"
- "30002:38082"