mirror of
https://github.com/skidoodle/iphistory.git
synced 2026-04-27 23:37:35 +02:00
fix docker lolololol
This commit is contained in:
+4
-5
@@ -7,7 +7,6 @@ FROM golang:alpine AS build-stage
|
||||
RUN apk add --no-cache ca-certificates
|
||||
WORKDIR /app
|
||||
COPY --from=generate-stage /app /app
|
||||
|
||||
RUN CGO_ENABLED=0 go build \
|
||||
-buildvcs=false \
|
||||
-ldflags="-s -w" \
|
||||
@@ -15,8 +14,8 @@ RUN CGO_ENABLED=0 go build \
|
||||
|
||||
FROM alpine:latest
|
||||
RUN apk --no-cache add ca-certificates
|
||||
WORKDIR /app/
|
||||
COPY --from=build-stage /app/iphistory .
|
||||
|
||||
RUN mkdir -p /data
|
||||
COPY --from=build-stage /app/iphistory /usr/local/bin/iphistory
|
||||
WORKDIR /
|
||||
EXPOSE 8080
|
||||
CMD ["./iphistory"]
|
||||
CMD ["/usr/local/bin/iphistory"]
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ services:
|
||||
ports:
|
||||
- "8080:8080"
|
||||
volumes:
|
||||
- data:/app
|
||||
- data:/data
|
||||
|
||||
volumes:
|
||||
data:
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"net/http"
|
||||
"os"
|
||||
"os/signal"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
"syscall"
|
||||
@@ -25,7 +26,15 @@ var assetsFS embed.FS
|
||||
func main() {
|
||||
logger := slog.New(slog.NewTextHandler(os.Stdout, nil))
|
||||
|
||||
store, err := NewStore("history.db")
|
||||
dbPath := "./data/history.db"
|
||||
dbDir := filepath.Dir(dbPath)
|
||||
|
||||
if err := os.MkdirAll(dbDir, 0755); err != nil {
|
||||
logger.Error("failed to create data directory", "err", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
store, err := NewStore(dbPath)
|
||||
if err != nil {
|
||||
logger.Error("db init failed", "err", err)
|
||||
os.Exit(1)
|
||||
|
||||
Reference in New Issue
Block a user