Skip to content

Commit f07568b

Browse files
authored
fix: pull doppler envs into docker compose (#271)
* write from doppler and use for docker * docker token + use that for doppler setup * update docs
1 parent 286f501 commit f07568b

File tree

4 files changed

+31
-6
lines changed

4 files changed

+31
-6
lines changed

CONTRIBUTING.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,24 @@
22

33
## Local Setup
44

5+
### Docker
6+
7+
To run the backend via Docker, the container fetches secrets directly from Doppler at startup using a service token.
8+
9+
Generate a token and export it in your shell:
10+
11+
```bash
12+
eval $(make docker-token)
13+
```
14+
15+
Then start the stack:
16+
17+
```bash
18+
make docker-up
19+
```
20+
21+
You'll need to re-run `eval $(make docker-token)` in any new shell session, or add `DOPPLER_TOKEN` to your shell profile.
22+
523
### OpenSearch
624

725
Run OpenSearch locally with the security plugin disabled (no TLS or auth required for local dev):

backend/Dockerfile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,16 @@ FROM alpine:latest
2626

2727
WORKDIR /app
2828

29+
# Install Doppler CLI
30+
RUN apk add --no-cache curl gnupg && \
31+
curl -Ls https://cli.doppler.com/install.sh | sh
32+
2933
# Copy the binary from the builder stage
3034
# Makefile builds to bin/selfserve
3135
COPY --from=builder /app/bin/selfserve .
3236

3337
# Expose port 8080
3438
EXPOSE 8080
3539

36-
# Command to run the executable
37-
CMD ["./selfserve"]
40+
# Doppler fetches secrets at runtime — DOPPLER_TOKEN must be set
41+
CMD ["doppler", "run", "--", "./selfserve"]

backend/Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ENV_FILE := config/.env
66
LOAD_ENV := doppler run --
77
LLM_URL := http://127.0.0.1:11434
88

9-
.PHONY: all build run dev test format tidy download clean docker-build docker-run docker-up docker-down \
9+
.PHONY: all build run dev test format tidy download clean docker-build docker-run docker-token docker-up docker-down \
1010
migrate-new migrate-up migrate-down migrate-status migrate-reset db-start db-stop db-reset swagger swagger-fmt docker-build docker-run llm-start genkit-run seed cli
1111

1212
all: build
@@ -83,8 +83,11 @@ docker-run:
8383
--name $(APP_NAME)-container \
8484
$(DOCKER_IMAGE_NAME)
8585

86+
docker-token:
87+
@echo "export DOPPLER_TOKEN=$$(doppler configs tokens create docker --project selfserve-backend --config prd --plain)"
88+
8689
docker-up:
87-
docker compose up --build
90+
@docker compose up --build
8891

8992
docker-down:
9093
docker compose down

backend/docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ services:
33
build: .
44
ports:
55
- "${PORT:-8080}:8080"
6-
env_file:
7-
- config/.env
6+
environment:
7+
- DOPPLER_TOKEN
88
depends_on:
99
- opensearch
1010
restart: unless-stopped

0 commit comments

Comments
 (0)