This commit is contained in:
2026-06-16 22:50:19 +07:00
parent 90b1937707
commit 5c7f3a4aca
5 changed files with 51 additions and 4 deletions
+1
View File
@@ -17,6 +17,7 @@
# Dependency directories (remove the comment below to include it)
# vendor/
bin/
# Go workspace file
go.work
+2
View File
@@ -0,0 +1,2 @@
FROM golang:1.26-alpine
RUN apk add --no-cache gcc musl-dev
+12 -2
View File
@@ -12,5 +12,15 @@ generate:
run:
go run ./cmd/${REPO_NAME_SNAKE}/main.go
build:
go build -o bin/${REPO_NAME_SNAKE} cmd/${REPO_NAME_SNAKE}/main.go
build-builder:
docker build -f Dockerfile.builder -t my-go-builder .
build-linux:
docker run --rm \
-v "$$PWD":/app \
-w /app \
my-go-builder sh -c \
"GOOS=linux GOARCH=arm64 go build -o bin/${REPO_NAME_SNAKE}_linux_arm64 cmd/${REPO_NAME_SNAKE}/main.go"
test:
go test -count=1 ./...
+7
View File
@@ -14,3 +14,10 @@ go mod tidy
```shell
make run
```
Сборка
```shell
make build-builder
make build-linux
```
+29 -2
View File
@@ -1,5 +1,9 @@
version: '3.8'
networks:
app_network:
driver: bridge
services:
${REPO_NAME}:
build:
@@ -7,5 +11,28 @@ services:
dockerfile: Dockerfile
ports:
- "8080:8080"
# environment:
# - ENV_VAR_NAME=env_var_value
environment:
- DATABASE_URL: "postgresql://postgres:postgres@postgres:5432/${REPO_NAME_SNAKE}?sslmode=disable"
depends_on:
- postgres
restart: unless-stopped
networks:
- app_network
postgres:
image: postgres:18
container_name: postgres18
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: ${REPO_NAME_SNAKE}
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
restart: unless-stopped
networks:
- app_network
volumes:
postgres_data: