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

1
.gitignore vendored
View File

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

View File

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

View File

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

0
data/.gitkeep Normal file
View File

View File

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