diff --git a/.dockerignore b/.dockerignore index dfd2b70..599ca4c 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,2 +1,8 @@ -/.idea -*.sqlite3* \ No newline at end of file +.git +.gitignore + +prayertimes.sqlite3 +prayertimes.sqlite3-wal +prayertimes.sqlite3-shm + +**/*.log diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..83678a6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,26 @@ +FROM golang:1.25-bookworm AS builder + +WORKDIR /src + +COPY go.mod go.sum ./ +RUN go mod download + +COPY . . +RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags="-s -w" -o /out/prayertimes . + +FROM debian:bookworm-slim + +RUN apt-get update \ + && apt-get install --no-install-recommends -y ca-certificates tzdata \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /app + +COPY --from=builder /out/prayertimes /usr/local/bin/prayertimes + +ENV PORT=8000 +ENV DB_PATH=/data/prayertimes.sqlite3 + +EXPOSE 8000 + +CMD ["/usr/local/bin/prayertimes"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..b93a2a7 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,16 @@ +services: + prayertimes: + build: + context: . + dockerfile: Dockerfile + container_name: prayertimes + ports: + - "8000:8000" + environment: + PORT: "8000" + DB_PATH: "/data/prayertimes.sqlite3" + volumes: + - ./prayertimes.sqlite3:/data/prayertimes.sqlite3 + - ./prayertimes.sqlite3-wal:/data/prayertimes.sqlite3-wal + - ./prayertimes.sqlite3-shm:/data/prayertimes.sqlite3-shm + restart: unless-stopped