chore(docker): Add Docker and development configuration files
- Add Dockerfile for multi-stage build process - Add .dockerignore to optimize Docker build context - Add docker-compose.yml for local development and deployment - Remove existing Makefile and replace with Docker-based workflow - Update .gitignore to exclude .env file - Update .env.example with consistent configuration - Remove sensitive .env file from version control - Prepare project for containerized development and deployment Streamlines project setup, improves development workflow, and enhances deployment flexibility with containerization.
This commit is contained in:
parent
155d4f78ac
commit
4f872b8350
37
.dockerignore
Normal file
37
.dockerignore
Normal file
@ -0,0 +1,37 @@
|
||||
# Git
|
||||
.git
|
||||
.gitignore
|
||||
.github
|
||||
|
||||
# IDE
|
||||
.vscode
|
||||
.kiro
|
||||
.idea
|
||||
|
||||
# Build artifacts
|
||||
bin/
|
||||
*.exe
|
||||
*.dll
|
||||
*.so
|
||||
*.dylib
|
||||
|
||||
# Test files
|
||||
*_test.go
|
||||
*.test
|
||||
*.out
|
||||
|
||||
# Environment files
|
||||
.env
|
||||
.env.local
|
||||
|
||||
# Documentation
|
||||
*.md
|
||||
docs/
|
||||
|
||||
# Misc
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
brainstorm.md
|
||||
nginx/
|
||||
scripts/
|
||||
Makefile
|
||||
34
.env
34
.env
@ -1,34 +0,0 @@
|
||||
# Server Configuration
|
||||
PORT=8080
|
||||
HOST=localhost
|
||||
|
||||
# Database Configuration
|
||||
DB_HOST=localhost
|
||||
DB_PORT=5432
|
||||
DB_USER=postgres
|
||||
DB_PASSWORD=123
|
||||
DB_NAME=booking_system
|
||||
DB_SSLMODE=disable
|
||||
|
||||
# JWT Configuration
|
||||
JWT_SECRET=your-super-secret-jwt-key
|
||||
JWT_EXPIRATION=24h
|
||||
|
||||
# Stripe Configuration
|
||||
STRIPE_SECRET_KEY=sk_test_your_stripe_secret_key
|
||||
STRIPE_WEBHOOK_SECRET=whsec_your_webhook_secret
|
||||
STRIPE_PUBLISHABLE_KEY=pk_test_your_publishable_key
|
||||
|
||||
# SMTP Configuration
|
||||
SMTP_HOST=smtp.hostinger.com
|
||||
SMTP_PORT=465
|
||||
SMTP_USERNAME=hello@attunehearttherapy.com
|
||||
SMTP_PASSWORD="G&n2S;ffTc8f"
|
||||
SMTP_FROM=hello@attunehearttherapy.com
|
||||
|
||||
# Jitsi Configuration
|
||||
# JITSI_BASE_URL=https://meet.jit.si
|
||||
JITSI_BASE_URL=https://meet.attunehearttherapy.com
|
||||
JITSI_API_KEY=your_jitsi_api_key
|
||||
JITSI_APP_ID=attunehearttherapy_id
|
||||
JITSI_PRIVATE_KEY=attunehearttherapy_jitsi_private_key
|
||||
20
.env.example
20
.env.example
@ -6,7 +6,7 @@ HOST=localhost
|
||||
DB_HOST=localhost
|
||||
DB_PORT=5432
|
||||
DB_USER=postgres
|
||||
DB_PASSWORD=your_password
|
||||
DB_PASSWORD=123
|
||||
DB_NAME=booking_system
|
||||
DB_SSLMODE=disable
|
||||
|
||||
@ -20,21 +20,15 @@ STRIPE_WEBHOOK_SECRET=whsec_your_webhook_secret
|
||||
STRIPE_PUBLISHABLE_KEY=pk_test_your_publishable_key
|
||||
|
||||
# SMTP Configuration
|
||||
SMTP_HOST=smtp.gmail.com
|
||||
SMTP_PORT=587
|
||||
SMTP_USERNAME=your_email@gmail.com
|
||||
SMTP_PASSWORD=your_app_password
|
||||
SMTP_FROM=your_email@gmail.com
|
||||
SMTP_HOST=smtp.hostinger.com
|
||||
SMTP_PORT=465
|
||||
SMTP_USERNAME=hello@attunehearttherapy.com
|
||||
SMTP_PASSWORD="G&n2S;ffTc8f"
|
||||
SMTP_FROM=hello@attunehearttherapy.com
|
||||
|
||||
# Jitsi Configuration
|
||||
# For public Jitsi (meet.jit.si) - JWT not required, leave API_KEY and APP_ID empty
|
||||
# JITSI_BASE_URL=https://meet.jit.si
|
||||
JITSI_BASE_URL=https://meet.attunehearttherapy.com
|
||||
JITSI_API_KEY=your_jitsi_api_key
|
||||
JITSI_APP_ID=attunehearttherapy_id
|
||||
JITSI_PRIVATE_KEY=attunehearttherapy_jitsi_private_key
|
||||
|
||||
# For self-hosted Jitsi with JWT authentication - fill in these values
|
||||
# JITSI_BASE_URL=https://meet.yourdomain.com
|
||||
# JITSI_API_KEY=your_jwt_secret_key
|
||||
# JITSI_APP_ID=your_jitsi_app_id
|
||||
JITSI_PRIVATE_KEY=your_jitsi_private_key
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
||||
.kiro/
|
||||
bin/
|
||||
.env
|
||||
48
Dockerfile
Normal file
48
Dockerfile
Normal file
@ -0,0 +1,48 @@
|
||||
# Build stage
|
||||
FROM golang:1.25.1-alpine AS builder
|
||||
|
||||
# Install build dependencies
|
||||
RUN apk add --no-cache git make
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy go mod files
|
||||
COPY go.mod go.sum ./
|
||||
|
||||
# Download dependencies
|
||||
RUN go mod download
|
||||
|
||||
# Copy source code
|
||||
COPY . .
|
||||
|
||||
# Build the server binary
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o server cmd/server/main.go
|
||||
|
||||
# Build the CLI binary (optional, for migrations)
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o cli cmd/cli/main.go
|
||||
|
||||
# Runtime stage
|
||||
FROM alpine:latest
|
||||
|
||||
# Install ca-certificates for HTTPS requests
|
||||
RUN apk --no-cache add ca-certificates tzdata
|
||||
|
||||
WORKDIR /root/
|
||||
|
||||
# Copy binaries from builder
|
||||
COPY --from=builder /app/server .
|
||||
COPY --from=builder /app/cli .
|
||||
|
||||
# Copy templates if they exist
|
||||
COPY --from=builder /app/internal/templates ./internal/templates
|
||||
|
||||
# Expose port (adjust if needed)
|
||||
EXPOSE 8080
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
||||
CMD wget --no-verbose --tries=1 --spider http://localhost:8080/health || exit 1
|
||||
|
||||
# Run the server
|
||||
CMD ["./server"]
|
||||
57
Makefile
57
Makefile
@ -1,57 +0,0 @@
|
||||
.PHONY: build run test clean deps server cli
|
||||
|
||||
# Build the server binary
|
||||
build:
|
||||
go build -o bin/server cmd/server/main.go
|
||||
|
||||
# Build the CLI binary
|
||||
build-cli:
|
||||
go build -o bin/cli cmd/cli/main.go
|
||||
|
||||
# Run the server
|
||||
run:
|
||||
go run cmd/server/main.go
|
||||
|
||||
# Run the CLI
|
||||
cli:
|
||||
go run cmd/cli/main.go
|
||||
|
||||
# Install dependencies
|
||||
deps:
|
||||
go mod tidy
|
||||
go mod download
|
||||
|
||||
# Run tests
|
||||
test:
|
||||
go test ./...
|
||||
|
||||
# Clean build artifacts
|
||||
clean:
|
||||
rm -rf bin/
|
||||
|
||||
# Format code
|
||||
fmt:
|
||||
go fmt ./...
|
||||
|
||||
# Vet code
|
||||
vet:
|
||||
go vet ./...
|
||||
|
||||
# Run linter (requires golangci-lint)
|
||||
lint:
|
||||
golangci-lint run
|
||||
|
||||
# Database operations
|
||||
db-migrate: build-cli
|
||||
./bin/cli migrate
|
||||
|
||||
db-health: build-cli
|
||||
./bin/cli db health
|
||||
|
||||
db-seed: build-cli
|
||||
./bin/cli db seed
|
||||
|
||||
# Development setup
|
||||
dev-setup: deps
|
||||
cp .env.example .env
|
||||
@echo "Please update .env file with your configuration"
|
||||
41
docker-compose.yml
Normal file
41
docker-compose.yml
Normal file
@ -0,0 +1,41 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
app:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
ports:
|
||||
- "8080:8080"
|
||||
environment:
|
||||
- DATABASE_URL=${DATABASE_URL}
|
||||
- JWT_SECRET=${JWT_SECRET}
|
||||
- STRIPE_SECRET_KEY=${STRIPE_SECRET_KEY}
|
||||
- SMTP_HOST=${SMTP_HOST}
|
||||
- SMTP_PORT=${SMTP_PORT}
|
||||
- SMTP_USERNAME=${SMTP_USERNAME}
|
||||
- SMTP_PASSWORD=${SMTP_PASSWORD}
|
||||
- JITSI_APP_ID=${JITSI_APP_ID}
|
||||
- JITSI_SECRET=${JITSI_SECRET}
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
restart: unless-stopped
|
||||
|
||||
postgres:
|
||||
image: postgres:16-alpine
|
||||
environment:
|
||||
- POSTGRES_DB=${POSTGRES_DB:-videoconf}
|
||||
- POSTGRES_USER=${POSTGRES_USER:-postgres}
|
||||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres}"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
Loading…
Reference in New Issue
Block a user