Skip to content

Commit 660c3de

Browse files
authored
Add dockerfiles / docker-compose file for all services (#11)
* Add dockerfiles / docker-compose file for all services * Remove release mode for local dev speed, todo add as profiles in future * Add start except
1 parent 2a9ba90 commit 660c3de

File tree

17 files changed

+255
-16
lines changed

17 files changed

+255
-16
lines changed

.dockerignore

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/target/
2+
**/target/
3+
/ui/node_modules
4+
/ui/.next
5+
.git
6+
/data
7+
*.log
8+
.env
9+
.env.docker
10+
/ui/.env
11+
.idea/
12+
.vscode/
13+
*.swp
14+
*.swo
15+
*~
16+
docs/
17+
README.md
18+
*.md
19+
!CLAUDE.md
20+
.DS_Store
21+
Thumbs.db
22+
Dockerfile*
23+
docker-compose*.yml
24+
.dockerignore
25+
.gitignore
26+
*.tmp
27+
*.temp
28+
.claude/
29+
**/*.orig

.env.example

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
# Ingress
2-
TIPS_INGRESS_ADDRESS=127.0.0.1
2+
TIPS_INGRESS_ADDRESS=0.0.0.0
33
TIPS_INGRESS_PORT=8080
44
TIPS_INGRESS_DATABASE_URL=postgresql://postgres:postgres@localhost:5432/postgres
55
TIPS_INGRESS_RPC_MEMPOOL=http://localhost:2222
66
TIPS_INGRESS_DUAL_WRITE_MEMPOOL=false
77
TIPS_INGRESS_KAFKA_BROKERS=localhost:9092
88
TIPS_INGRESS_KAFKA_TOPIC=tips-audit
9-
TIPS_INGRESS_LOG_LEVEL=info
9+
TIPS_INGRESS_LOG_LEVEL=debug
1010
TIPS_INGRESS_KAFKA_QUEUE_TOPIC=tips-ingress
1111

1212
# Audit service configuration
1313
TIPS_AUDIT_KAFKA_BROKERS=localhost:9092
1414
TIPS_AUDIT_KAFKA_TOPIC=tips-audit
1515
TIPS_AUDIT_KAFKA_GROUP_ID=local-audit
16-
TIPS_AUDIT_LOG_LEVEL=info
16+
TIPS_AUDIT_LOG_LEVEL=debug
1717
TIPS_AUDIT_S3_BUCKET=tips
1818
TIPS_AUDIT_S3_CONFIG_TYPE=manual
1919
TIPS_AUDIT_S3_ENDPOINT=http://localhost:7000
@@ -27,7 +27,7 @@ TIPS_MAINTENANCE_RPC_NODE=http://localhost:2222
2727
TIPS_MAINTENANCE_KAFKA_BROKERS=localhost:9092
2828
TIPS_MAINTENANCE_KAFKA_TOPIC=tips-audit
2929
TIPS_MAINTENANCE_POLL_INTERVAL_MS=250
30-
TIPS_MAINTENANCE_LOG_LEVEL=info
30+
TIPS_MAINTENANCE_LOG_LEVEL=debug
3131

3232
# TIPS UI
3333
TIPS_DATABASE_URL=postgresql://postgres:postgres@localhost:5432/postgres
@@ -36,4 +36,4 @@ TIPS_UI_S3_BUCKET_NAME=tips
3636
TIPS_UI_S3_CONFIG_TYPE=manual
3737
TIPS_UI_S3_ENDPOINT=http://localhost:7000
3838
TIPS_UI_S3_ACCESS_KEY_ID=minioadmin
39-
TIPS_UI_S3_SECRET_ACCESS_KEY=minioadmin
39+
TIPS_UI_S3_SECRET_ACCESS_KEY=minioadmin

.github/workflows/docker.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Docker Build
2+
permissions:
3+
contents: read
4+
5+
on:
6+
push:
7+
branches: [ master ]
8+
pull_request:
9+
branches: [ master ]
10+
11+
jobs:
12+
docker-build:
13+
name: Docker Build
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- run: cp .env.example .env.docker
18+
- run: docker compose -f docker-compose.tips.yml build

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Thumbs.db
1818

1919
# Environment variables
2020
.env
21+
.env.docker
2122
/ui/.env
2223

2324
# Claude

crates/audit/Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM rust:1-bookworm AS builder
2+
3+
WORKDIR /app
4+
5+
COPY Cargo.toml Cargo.lock ./
6+
COPY crates/ ./crates/
7+
8+
RUN cargo build --bin tips-audit
9+
10+
FROM debian:bookworm
11+
12+
RUN apt-get update && apt-get install -y libssl3 ca-certificates && rm -rf /var/lib/apt/lists/*
13+
14+
WORKDIR /app
15+
16+
COPY --from=builder /app/target/debug/tips-audit /app/tips-audit
17+
18+
EXPOSE 3001
19+
20+
CMD ["/app/tips-audit"]

crates/ingress/Dockerfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM rust:1-bookworm AS builder
2+
3+
WORKDIR /app
4+
5+
COPY Cargo.toml Cargo.lock ./
6+
COPY crates/ ./crates/
7+
COPY .sqlx/ ./.sqlx/
8+
9+
RUN cargo build --bin tips-ingress
10+
11+
FROM debian:bookworm
12+
13+
RUN apt-get update && apt-get install -y libssl3 && rm -rf /var/lib/apt/lists/*
14+
15+
WORKDIR /app
16+
17+
COPY --from=builder /app/target/debug/tips-ingress /app/tips-ingress
18+
19+
EXPOSE 3000
20+
21+
CMD ["/app/tips-ingress"]

crates/ingress/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use tips_datastore::PostgresDatastore;
2020
#[command(author, version, about, long_about = None)]
2121
struct Config {
2222
/// Address to bind the RPC server to
23-
#[arg(long, env = "TIPS_INGRESS_ADDRESS", default_value = "127.0.0.1")]
23+
#[arg(long, env = "TIPS_INGRESS_ADDRESS", default_value = "0.0.0.0")]
2424
address: IpAddr,
2525

2626
/// Port to bind the RPC server to

crates/maintenance/Dockerfile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM rust:1-bookworm AS builder
2+
3+
WORKDIR /app
4+
5+
COPY Cargo.toml Cargo.lock ./
6+
COPY crates/ ./crates/
7+
COPY .sqlx/ ./.sqlx/
8+
9+
RUN cargo build --bin tips-maintenance
10+
11+
FROM debian:bookworm
12+
13+
RUN apt-get update && apt-get install -y libssl3 && rm -rf /var/lib/apt/lists/*
14+
15+
WORKDIR /app
16+
17+
COPY --from=builder /app/target/debug/tips-maintenance /app/tips-maintenance
18+
19+
CMD ["/app/tips-maintenance"]

docker-compose.tips.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
services:
2+
ingress-rpc:
3+
build:
4+
context: .
5+
dockerfile: crates/ingress/Dockerfile
6+
container_name: tips-ingress
7+
ports:
8+
- "8080:8080"
9+
env_file:
10+
- .env.docker
11+
restart: unless-stopped
12+
13+
audit:
14+
build:
15+
context: .
16+
dockerfile: crates/audit/Dockerfile
17+
container_name: tips-audit
18+
env_file:
19+
- .env.docker
20+
restart: unless-stopped
21+
22+
maintenance:
23+
build:
24+
context: .
25+
dockerfile: crates/maintenance/Dockerfile
26+
container_name: tips-maintenance
27+
env_file:
28+
- .env.docker
29+
restart: unless-stopped
30+
31+
ui:
32+
build:
33+
context: .
34+
dockerfile: ui/Dockerfile
35+
ports:
36+
- "3000:3000"
37+
container_name: tips-ui
38+
env_file:
39+
- .env.docker
40+
restart: unless-stopped

docker-compose.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,12 @@ services:
2222
container_name: tips-kafka
2323
ports:
2424
- "9092:9092"
25+
- "9094:9094"
2526
environment:
2627
KAFKA_BROKER_ID: 1
27-
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT,CONTROLLER:PLAINTEXT
28-
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:29092,PLAINTEXT_HOST://localhost:9092
29-
KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:29092,CONTROLLER://0.0.0.0:9093,PLAINTEXT_HOST://0.0.0.0:9092
28+
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT,PLAINTEXT_DOCKER:PLAINTEXT,CONTROLLER:PLAINTEXT
29+
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:29092,PLAINTEXT_HOST://localhost:9092,PLAINTEXT_DOCKER://host.docker.internal:9094
30+
KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:29092,CONTROLLER://0.0.0.0:9093,PLAINTEXT_HOST://0.0.0.0:9092,PLAINTEXT_DOCKER://0.0.0.0:9094
3031
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
3132
KAFKA_CONTROLLER_LISTENER_NAMES: CONTROLLER
3233
KAFKA_ZOOKEEPER_CONNECT: ' '
@@ -88,5 +89,4 @@ services:
8889
/usr/bin/mc mb minio/tips;
8990
/usr/bin/mc anonymous set public minio/tips;
9091
exit 0;
91-
"
92-
92+
"

0 commit comments

Comments
 (0)