Skip to content

Commit f4e0209

Browse files
committed
feat(heartbeat): Add docker setup files
1 parent 23667ff commit f4e0209

File tree

3 files changed

+65
-0
lines changed

3 files changed

+65
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
target/
2+
.env
3+
.env.*
4+
data/
5+
*.db
6+
.git/
7+
.gitignore
8+
.dockerignore
9+
README.md
10+
# Ensure .sqlx files are included
11+
!.sqlx/
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Build stage
2+
FROM rust:1.84-slim-bookworm AS builder
3+
4+
WORKDIR /usr/src/app
5+
RUN apt-get update && apt-get install -y pkg-config libssl-dev && rm -rf /var/lib/apt/lists/*
6+
7+
COPY Cargo.toml ./
8+
9+
# Handle deps first to cache them
10+
RUN mkdir src && echo "fn main() {}" > src/main.rs
11+
RUN cargo build --release
12+
RUN rm -f target/release/deps/heartbeats_processor*
13+
14+
# With deps in place, copy code and build
15+
COPY . .
16+
RUN cargo build --release
17+
18+
# Runtime stage
19+
FROM debian:bookworm-slim
20+
21+
RUN apt-get update && apt-get install -y libsqlite3-0 ca-certificates && rm -rf /var/lib/apt/lists/*
22+
23+
WORKDIR /app
24+
25+
COPY --from=builder /usr/src/app/target/release/heartbeats-processor .
26+
COPY schema.sql .
27+
28+
ENV DATABASE_PATH=/app/data/heartbeats.db
29+
30+
ENTRYPOINT ["./heartbeats-processor"]
31+
CMD ["process-loop"]
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
version: '3.8'
2+
3+
services:
4+
heartbeats-processor:
5+
#build: .
6+
image: openmina/heartbeat-processor:local
7+
environment:
8+
- GOOGLE_CLOUD_PROJECT=${GOOGLE_CLOUD_PROJECT:-staging}
9+
- WINDOW_RANGE_START=${WINDOW_RANGE_START:-}
10+
- WINDOW_RANGE_END=${WINDOW_RANGE_END:-}
11+
#- FIRESTORE_EMULATOR_HOST=${FIRESTORE_EMULATOR_HOST:-}
12+
- DISABLED_WINDOWS=${DISABLED_WINDOWS:-}
13+
- GOOGLE_APPLICATION_CREDENTIALS=/credentials/service-account.json
14+
- DATABASE_PATH=${DATABASE_PATH:-/app/data/store.db}
15+
volumes:
16+
- ./data:/app/data
17+
- ./credentials:/credentials:ro
18+
command: ["process-loop", "--interval-seconds", "300"]
19+
restart: unless-stopped
20+
21+
volumes:
22+
data:
23+
driver: local

0 commit comments

Comments
 (0)