Skip to content

Commit 02b06d1

Browse files
committed
Add dockerfiles / docker-compose file for all services
1 parent 74676cc commit 02b06d1

File tree

16 files changed

+203
-11
lines changed

16 files changed

+203
-11
lines changed

.dockerignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/target/
2+
/ui/node_modules
3+
/ui/.next
4+
.git
5+
/data
6+
*.log
7+
.env
8+
.env.docker
9+
/ui/.env

.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 --release --bin tips-audit
9+
10+
FROM debian:bookworm
11+
12+
RUN apt-get update && apt-get install -y libssl3 && rm -rf /var/lib/apt/lists/*
13+
14+
WORKDIR /app
15+
16+
COPY --from=builder /app/target/release/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 --release --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/release/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
@@ -18,7 +18,7 @@ use tips_datastore::PostgresDatastore;
1818
#[command(author, version, about, long_about = None)]
1919
struct Config {
2020
/// Address to bind the RPC server to
21-
#[arg(long, env = "TIPS_INGRESS_ADDRESS", default_value = "127.0.0.1")]
21+
#[arg(long, env = "TIPS_INGRESS_ADDRESS", default_value = "0.0.0.0")]
2222
address: IpAddr,
2323

2424
/// 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 --release --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/release/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+
tips-ingress:
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+
tips-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+
tips-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+
tips-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: ' '
@@ -87,5 +88,4 @@ services:
8788
/usr/bin/mc mb minio/tips;
8889
/usr/bin/mc anonymous set public minio/tips;
8990
exit 0;
90-
"
91-
91+
"

justfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,21 @@ sync: deps-reset
2727
cd ui && mv ./drizzle/schema.ts ./src/db/
2828
cd ui && rm -rf ./drizzle
2929
### ENV ###
30+
just sync-env
31+
### REFORMAT ###
32+
just fix
33+
34+
sync-env:
3035
cp .env.example .env
3136
cp .env.example ./ui/.env
37+
cp .env.example .env.docker
38+
# Change kafka ports
39+
sed -i '' 's/localhost:9092/host.docker.internal:9094/g' ./.env.docker
40+
# Change other dependencies
41+
sed -i '' 's/localhost/host.docker.internal/g' ./.env.docker
42+
43+
start-all:
44+
export COMPOSE_FILE=docker-compose.yml:docker-compose.tips.yml && docker compose down && docker compose rm && docker compose build && rm -rf data/ && mkdir -p data/postgres data/kafka data/minio && docker compose up -d
3245

3346
### RUN SERVICES ###
3447
deps-reset:

0 commit comments

Comments
 (0)