fix docker lolololol

This commit is contained in:
2026-01-11 18:14:03 +01:00
parent 8a5fb3d9dd
commit 30b01eb559
4 changed files with 16 additions and 8 deletions
+4 -5
View File
@@ -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
View File
@@ -6,7 +6,7 @@ services:
ports:
- "8080:8080"
volumes:
- data:/app
- data:/data
volumes:
data:
+10 -1
View File
@@ -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)
+1 -1
View File
@@ -15,7 +15,7 @@ services:
ports:
- "8080:8080"
volumes:
- data:/app
- data:/data
volumes:
data: