diff --git a/.gitignore b/.gitignore index 302af075..e9ad3939 100755 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,7 @@ app/cake_eclipse_helper.php app/webroot/pdf/* app/webroot/attachments_files/* backups/* + +# Go binaries +go/server +go/vault diff --git a/Dockerfile.local.go b/Dockerfile.local.go new file mode 100644 index 00000000..2c37cd43 --- /dev/null +++ b/Dockerfile.local.go @@ -0,0 +1,27 @@ +FROM golang:1.24-alpine + +WORKDIR /app + +# Copy go.mod and go.sum first +COPY go/go.mod go/go.sum ./ + +# Download dependencies +RUN go mod download + +# Install Air for hot reload (pinned to v1.52.3 for Go 1.24 compatibility) +RUN go install github.com/air-verse/air@v1.52.3 +# Install sqlc for SQL code generation +RUN go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest + +# Copy source code +COPY go/ . + +# Generate sqlc code +RUN sqlc generate + +# Copy Air config +COPY go/.air.toml .air.toml + +EXPOSE 8080 + +CMD ["air", "-c", ".air.toml"] \ No newline at end of file diff --git a/go/.env.example b/go/.env.example deleted file mode 100644 index 097f7288..00000000 --- a/go/.env.example +++ /dev/null @@ -1,12 +0,0 @@ -# Database configuration -DB_HOST=db -DB_PORT=3306 -DB_USER=cmc -DB_PASSWORD=xVRQI&cA?7AU=hqJ!%au -DB_NAME=cmc - -# Root database password (for dbshell-root) -DB_ROOT_PASSWORD=secureRootPassword - -# Server configuration -PORT=8080 \ No newline at end of file diff --git a/go/.gitignore b/go/.gitignore deleted file mode 100644 index ea2b3066..00000000 --- a/go/.gitignore +++ /dev/null @@ -1,40 +0,0 @@ -# Binaries -bin/ -*.exe -*.exe~ -*.dll -*.so -*.dylib - -# Test binary, built with `go test -c` -*.test - -# Output of the go coverage tool -*.out - -# Go vendor directory -vendor/ - -# Environment files -.env - -# Generated sqlc files (optional - you may want to commit these) -# internal/cmc/db/*.go - -# IDE specific files -.idea/ -.vscode/ -*.swp -*.swo -*~ - -# OS specific files -.DS_Store -Thumbs.db - -# Goose database migration config -goose.env - -# Gmail OAuth credentials - NEVER commit these! -credentials.json -token.json diff --git a/scripts/archive/ci/Dockerfile.local.go b/scripts/archive/ci/Dockerfile.local.go deleted file mode 100644 index 9a787c48..00000000 --- a/scripts/archive/ci/Dockerfile.local.go +++ /dev/null @@ -1,23 +0,0 @@ -# Dev Dockerfile for Go hot reload with Air and sqlc -FROM golang:1.24.0 - -WORKDIR /app - -# Install Air for hot reload -RUN go install github.com/air-verse/air@latest -# Install sqlc for SQL code generation -RUN go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest - -# Copy source code -COPY go-app/ . - -# Generate sqlc code -RUN sqlc generate - -# Copy Air config -COPY go-app/.air.toml .air.toml -COPY go-app/.env.example .env - -EXPOSE 8080 - -CMD ["air", "-c", ".air.toml"] \ No newline at end of file diff --git a/start-development.sh b/start-development.sh index 9693273c..29910af9 100755 --- a/start-development.sh +++ b/start-development.sh @@ -83,7 +83,7 @@ else echo -e "${YELLOW}🏥 Checking service health...${NC}" # Check database - if docker compose exec -T db mysqladmin ping -h localhost -u cmc -p'xVRQI&cA?7AU=hqJ!%au' --silent; then + if docker compose exec -T db mariadb-admin ping -h localhost -u cmc -p'xVRQI&cA?7AU=hqJ!%au' --silent; then echo -e "${GREEN}✅ Database is ready${NC}" else echo -e "${RED}❌ Database is not ready${NC}"