feat: some refactoring

This commit is contained in:
2025-11-22 22:23:49 +03:00
parent a247e6213e
commit 51f30b516e
29 changed files with 1094 additions and 129 deletions

31
build/Dockerfile Normal file
View File

@@ -0,0 +1,31 @@
# Build stage
FROM golang:1.25-alpine AS builder
WORKDIR /app
# Copy go mod files
COPY go.mod go.sum ./
# Download dependencies
RUN go mod download
# Copy source code
COPY . .
# Build the application
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o apiserver ./cmd/apiserver
# Final stage
FROM alpine:latest
WORKDIR /root/
# Copy binary from builder stage
COPY --from=builder /app/apiserver .
COPY --from=builder /app/configs ./configs
# Expose port
EXPOSE 8080
# Run the application
CMD ["./apiserver", "--config-path=./configs/server.toml"]

23
build/docker-compose.yml Normal file
View File

@@ -0,0 +1,23 @@
version: '3.8'
services:
apiserver:
build:
context: ..
dockerfile: build/Dockerfile
container_name: mygoserver
ports:
- "8080:8080"
volumes:
- ../configs:/root/configs:ro
environment:
- LOGGING_LEVEL=info
- LOGGING_FORMAT=json
- LOGGING_OUTPUT=stdout
restart: unless-stopped
networks:
- app-network
networks:
app-network:
driver: bridge