Added: debug environment in container

This commit is contained in:
Aleksandr Soloshenko 2023-11-01 23:42:24 +07:00
parent 3ec7a17a00
commit 26cced8641
3 changed files with 47 additions and 2 deletions

View File

@ -22,9 +22,21 @@ db-upgrade:
db-upgrade-raw:
go run ./cmd/$(project_name)/main.go db-upgrade
run:
go run cmd/$(project_name)/main.go
test:
go test ./...
go test -cover ./...
build:
go build ./cmd/$(project_name)
install:
go install ./cmd/$(project_name)
docker-dev:
docker-compose -f deployments/docker-compose/docker-compose.dev.yml up --build
api-docs:
swag fmt -g ./cmd/$(project_name)/main.go \
@ -33,4 +45,4 @@ api-docs:
view-docs:
php -S 127.0.0.1:8080 -t ./api
.PHONY: init init-dev air db-upgrade db-upgrade-raw test api-docs view-docs
.PHONY: init init-dev air run test install api-docs docker-dev view-docs

View File

@ -0,0 +1,15 @@
FROM golang:1.20-alpine
ENV GO111MODULE="on"
ENV GOOS="linux"
ENV CGO_ENABLED=0
WORKDIR /app
RUN go install github.com/cosmtrek/air@latest && \
go install github.com/go-delve/delve/cmd/dlv@latest
EXPOSE 2345
EXPOSE 3000
CMD ["air", "-c", ".air.toml"]

View File

@ -0,0 +1,18 @@
version: '3'
services:
sms-gateway:
image: sms-gateway
build:
context: .
dockerfile: ../../build/package/Dockerfile.dev
container_name: sms-gateway
environment:
- DEBUG=1
ports:
- "4000:3000"
- "3456:2345"
volumes:
- "../..:/app"
- "/tmp/sms-gateway/go-cache:/go/pkg"
restart: 'no'