-
Notifications
You must be signed in to change notification settings - Fork 7
Add Dockerfile and Compose Setup for Helios #39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c974f0f
14dfb8b
d69ceed
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| .git | ||
| *.md | ||
| *.bat | ||
| *.csv | ||
| *.log | ||
| *.test | ||
| __pycache__/ | ||
| node_modules/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| # Stage 1: Build | ||
| FROM golang:1.20-alpine AS builder | ||
| WORKDIR /app | ||
|
|
||
| # Copy module files and download dependencies | ||
| COPY go.mod go.sum ./ | ||
| RUN go mod download | ||
|
|
||
| # Copy source files explicitly | ||
| COPY cmd/helios ./cmd/helios | ||
| COPY internal/ ./internal | ||
| COPY helios.docker.yaml . | ||
| COPY certs/ certs/ | ||
|
|
||
| # Build the binary | ||
| RUN go build -o helios ./cmd/helios | ||
|
|
||
| # Stage 2: Runtime | ||
| FROM alpine:3.18 | ||
| WORKDIR /app | ||
|
|
||
| # Copy built binary and config | ||
| COPY --from=builder /app/helios . | ||
| COPY helios.docker.yaml . | ||
| COPY certs/ certs/ | ||
|
|
||
| # Create non-root user | ||
| RUN addgroup -S helios && adduser -S helios -G helios | ||
| USER helios | ||
|
|
||
| EXPOSE 8080 9090 9091 | ||
| CMD ["./helios", "--config=helios.docker.yaml"] | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| FROM nginx:alpine | ||
| COPY default.conf /etc/nginx/conf.d/default.conf |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| server { | ||
| listen 80; | ||
| location / { | ||
| return 200 "Backend is alive\n"; | ||
| add_header Content-Type text/plain; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| version: "3.8" | ||
|
|
||
| services: | ||
| helios: | ||
| build: . | ||
| ports: | ||
| - "8080:8080" | ||
| - "9090:9090" | ||
| - "9091:9091" | ||
| volumes: | ||
| - ./helios.docker.yaml:/app/helios.docker.yaml | ||
| - ./certs:/app/certs | ||
| depends_on: | ||
| - backend1 | ||
| - backend2 | ||
| - backend3 | ||
|
Comment on lines
+13
to
+16
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
| healthcheck: | ||
| test: | ||
| [ | ||
| "CMD", | ||
| "wget", | ||
| "--quiet", | ||
| "--tries=1", | ||
| "--spider", | ||
| "http://localhost:8080", | ||
| ] | ||
| interval: 10s | ||
| timeout: 5s | ||
| retries: 3 | ||
| restart: unless-stopped | ||
|
|
||
| backend1: | ||
| build: | ||
| context: . | ||
| dockerfile: Dockerfile.backend | ||
| ports: | ||
| - "8081:80" | ||
|
|
||
| backend2: | ||
| build: | ||
| context: . | ||
| dockerfile: Dockerfile.backend | ||
| ports: | ||
| - "8082:80" | ||
|
|
||
| backend3: | ||
| build: | ||
| context: . | ||
| dockerfile: Dockerfile.backend | ||
| ports: | ||
| - "8083:80" | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ Getting worse: Complex Method
main already has high cyclomatic complexity, and now it increases in Lines of Code from 125 to 127
Suppress