[chore] configure Docker for local environment#17
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR adds MinIO S3 storage support with configurable TLS, environment configuration documentation, Docker build, and docker-compose wiring to run the backend locally with MariaDB and MinIO. ChangesLocal Docker development and MinIO storage
Sequence DiagramsequenceDiagram
participant User as User: docker compose up
participant Compose as Docker Compose
participant MariaDB as mariadb
participant MinIO as minio
participant MinIOInit as minio-init
participant Backend as backend
User->>Compose: up --build
Compose->>MariaDB: start
Compose->>MinIO: start
Compose->>MinIOInit: start (depends_on minio healthy)
MinIO-->>Compose: healthy
MinIOInit->>MinIO: configure bucket
MariaDB-->>Compose: healthy
Compose->>Backend: start (depends_on mariadb health + minio-init)
Backend->>MariaDB: connect via DATABASE__URL
Backend->>MinIO: connect via STORAGE__URL
🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🤖 Pull request artifacts
|
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
Dockerfile (2)
15-15: ⚡ Quick win
alpine:3.22.2is behind the current patch — consideralpine:3.22oralpine:3.22.4Docker Hub currently lists
3.22.4as the latest3.22.xpatch. Pinning to3.22.2for the runtime image means missing any CVE/security fixes shipped in3.22.3and3.22.4. For the runtime stage, prefer the floating minor tag (alpine:3.22) to track patches automatically, or bump toalpine:3.22.4.🔧 Proposed fix
-FROM alpine:3.22.2 +FROM alpine:3.22🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@Dockerfile` at line 15, Update the base image reference in the Dockerfile's FROM instruction (currently "FROM alpine:3.22.2") to a non-outdated tag—either use the floating minor tag "alpine:3.22" to get future patch updates automatically, or bump to the specific patched release "alpine:3.22.4" so the runtime image includes the latest CVE/security fixes.
12-12: ⚡ Quick winConsider using
go build .for idiomatic Go styleWhile
go build ./main.goworks fine in this repository, the idiomatic form isgo build .(orgo build ./cmd/...). Using the file argument can silently exclude otherpackage mainsource files if they exist in the same directory, though this repository currently contains onlymain.goat the root.🔧 Proposed fix
-RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o /out/server ./main.go +RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o /out/server .🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@Dockerfile` at line 12, Replace the explicit file argument in the Dockerfile RUN command so the Go build uses the package path rather than a filename: update the RUN line that currently invokes "CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags=\"-s -w\" -o /out/server ./main.go" to use "go build ." (keeping CGO_ENABLED, GOOS, -trimpath, -ldflags and -o /out/server intact) to ensure all package main sources in the directory are included.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docker-compose.yml`:
- Around line 7-8: Update the backend service's compose configuration so it
waits for the mariadb healthcheck to pass and restarts on transient failures:
replace the simple depends_on: - mariadb with a depends_on entry referencing
mariadb: condition: service_healthy (so the backend waits until the mariadb
healthcheck passes) and add restart: on-failure to the backend service to
automatically retry if it still races on first start.
In `@Dockerfile`:
- Around line 10-12: The Docker build is copying the entire context via the COPY
. . step which can bake secrets into the build cache; add a .dockerignore to
exclude sensitive and unnecessary files (at minimum: .env, local.docker.yml,
.aws/, .git, Dockerfile, node_modules, *.log, and any local config/secrets) so
those files are not sent to the daemon or included in builder layers, commit the
.dockerignore to repo root, and keep the existing Dockerfile (the COPY . . line
will then respect the .dockerignore).
---
Nitpick comments:
In `@Dockerfile`:
- Line 15: Update the base image reference in the Dockerfile's FROM instruction
(currently "FROM alpine:3.22.2") to a non-outdated tag—either use the floating
minor tag "alpine:3.22" to get future patch updates automatically, or bump to
the specific patched release "alpine:3.22.4" so the runtime image includes the
latest CVE/security fixes.
- Line 12: Replace the explicit file argument in the Dockerfile RUN command so
the Go build uses the package path rather than a filename: update the RUN line
that currently invokes "CGO_ENABLED=0 GOOS=linux go build -trimpath
-ldflags=\"-s -w\" -o /out/server ./main.go" to use "go build ." (keeping
CGO_ENABLED, GOOS, -trimpath, -ldflags and -o /out/server intact) to ensure all
package main sources in the directory are included.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: eae7f09e-2d13-4d9c-988b-7938b9d964a8
📒 Files selected for processing (6)
.env.example.gitignoreDOCKER.mdDockerfiledocker-compose.ymllocal.docker.yml.example
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@DOCKER.md`:
- Line 31: Fix the punctuation in the sentence "Presigned-ссылки для вложений
должны совпадать с тем URL, по которому **браузер** открывает тот же S3 (как
правило публичный HTTPS endpoint провайдера)." by inserting a comma after "как
правило" so it reads "(как правило, публичный HTTPS endpoint провайдера)";
update the DOCKER.md sentence accordingly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 70de6131-642b-43f4-9d38-828d6789c0dc
📒 Files selected for processing (4)
.dockerignore.dockerignoreDOCKER.mddocker-compose.yml
✅ Files skipped from review due to trivial changes (2)
- docker-compose.yml
- .dockerignore
0d61250 to
ade8c93
Compare
|
This PR is stale because it has been open for 7 days with no activity. |
ade8c93 to
023572b
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docker-compose.yml`:
- Line 19: The docker-compose env interpolation uses the wrong variable name:
change the JWT fallback from ${JWT_SECRET:-secret} to ${JWT__SECRET:-secret} so
it matches the documented/expected JWT__SECRET used by the backend; update the
JWT__SECRET reference in the docker-compose.yml environment block (replace
JWT_SECRET with JWT__SECRET) to ensure values from .env.example/.env are applied
to the backend JWT configuration.
- Around line 20-24: Replace the host in STORAGE__URL so the backend talks to
the MinIO service by name (use minio:9000) instead of localhost, and remove the
unnecessary extra_hosts entry; specifically update the STORAGE__URL environment
value (STORAGE__URL) to point to
s3://bit-issues/uploads?endpoint=minio:9000®ion=us-east-1&insecure=true and
delete the extra_hosts: - "localhost:host-gateway" stanza so
container-to-container traffic uses the Compose service name `minio`.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 512dd222-d050-4a2f-b21e-e82b9982a017
📒 Files selected for processing (6)
.env.exampleDockerfiledocker-compose.ymlinternal/storage/module.gopkg/miniofx/client.gopkg/miniofx/config.go
✅ Files skipped from review due to trivial changes (1)
- pkg/miniofx/config.go
Summary by CodeRabbit
New Features
Documentation