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) # Dependency directories (remove the comment below to include it)
# vendor/ # vendor/
bin/
# Go workspace file # Go workspace file
go.work 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: run:
go run ./cmd/${REPO_NAME_SNAKE}/main.go go run ./cmd/${REPO_NAME_SNAKE}/main.go
build: build-builder:
go build -o bin/${REPO_NAME_SNAKE} cmd/${REPO_NAME_SNAKE}/main.go 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 ```shell
make run make run
``` ```
Сборка
```shell
make build-builder
make build-linux
```
+29 -2
View File
@@ -1,5 +1,9 @@
version: '3.8' version: '3.8'
networks:
app_network:
driver: bridge
services: services:
${REPO_NAME}: ${REPO_NAME}:
build: build:
@@ -7,5 +11,28 @@ services:
dockerfile: Dockerfile dockerfile: Dockerfile
ports: ports:
- "8080:8080" - "8080:8080"
# environment: environment:
# - ENV_VAR_NAME=env_var_value - 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: