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
|
RUN apk add --no-cache ca-certificates
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=generate-stage /app /app
|
COPY --from=generate-stage /app /app
|
||||||
|
|
||||||
RUN CGO_ENABLED=0 go build \
|
RUN CGO_ENABLED=0 go build \
|
||||||
-buildvcs=false \
|
-buildvcs=false \
|
||||||
-ldflags="-s -w" \
|
-ldflags="-s -w" \
|
||||||
@@ -15,8 +14,8 @@ RUN CGO_ENABLED=0 go build \
|
|||||||
|
|
||||||
FROM alpine:latest
|
FROM alpine:latest
|
||||||
RUN apk --no-cache add ca-certificates
|
RUN apk --no-cache add ca-certificates
|
||||||
WORKDIR /app/
|
RUN mkdir -p /data
|
||||||
COPY --from=build-stage /app/iphistory .
|
COPY --from=build-stage /app/iphistory /usr/local/bin/iphistory
|
||||||
|
WORKDIR /
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
CMD ["./iphistory"]
|
CMD ["/usr/local/bin/iphistory"]
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- "8080:8080"
|
- "8080:8080"
|
||||||
volumes:
|
volumes:
|
||||||
- data:/app
|
- data:/data
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
data:
|
data:
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
@@ -25,7 +26,15 @@ var assetsFS embed.FS
|
|||||||
func main() {
|
func main() {
|
||||||
logger := slog.New(slog.NewTextHandler(os.Stdout, nil))
|
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 {
|
if err != nil {
|
||||||
logger.Error("db init failed", "err", err)
|
logger.Error("db init failed", "err", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
|||||||
Reference in New Issue
Block a user