forked from ebhomengo/niki
feat: add air for watch project changes
This commit is contained in:
parent
23fedc02c3
commit
0269822fc0
|
|
@ -0,0 +1,34 @@
|
|||
root = "."
|
||||
tmp_dir = "cmd/productapp/temp"
|
||||
|
||||
[build]
|
||||
bin = "/entrypoint.sh"
|
||||
args_bin = []
|
||||
cmd = "go build -mod=mod -buildvcs=false -o ./cmd/productapp/temp/main ./cmd/productapp/"
|
||||
delay = 1000
|
||||
exclude_dir = ["vendor", "cmd/productapp/temp"]
|
||||
exclude_file = []
|
||||
exclude_regex = []
|
||||
exclude_unchanged = false
|
||||
follow_symlink = false
|
||||
include_dir = []
|
||||
include_ext = ["go"]
|
||||
kill_delay = "0s"
|
||||
log = "build-errors.log"
|
||||
send_interrupt = false
|
||||
stop_on_error = true
|
||||
poll = true
|
||||
poll_interval = 1000
|
||||
|
||||
[color]
|
||||
app = ""
|
||||
build = "yellow"
|
||||
main = "magenta"
|
||||
runner = "green"
|
||||
watcher = "cyan"
|
||||
|
||||
[log]
|
||||
time = false
|
||||
|
||||
[misc]
|
||||
clean_on_exit = false
|
||||
7
Makefile
7
Makefile
|
|
@ -81,7 +81,7 @@ confirm:
|
|||
# ====================================================================================
|
||||
# Productapp Service Commands
|
||||
# ====================================================================================
|
||||
.PHONY: productapp-up productapp-up-logs
|
||||
.PHONY: productapp-up productapp-up-logs productapp-rebuild productapp-watch
|
||||
|
||||
PRODUCTAPP_ENV = deploy/productapp/development/.env
|
||||
PRODUCTAPP_COMPOSE = deploy/productapp/development/docker-compose.yml
|
||||
|
|
@ -91,6 +91,11 @@ productapp-up:
|
|||
docker compose --env-file $(PRODUCTAPP_ENV) -f $(PRODUCTAPP_COMPOSE) up --build -d
|
||||
@echo "productapp stack is up."
|
||||
|
||||
productapp-down:
|
||||
@echo "Building and starting productapp full stack..."
|
||||
docker compose --env-file $(PRODUCTAPP_ENV) -f $(PRODUCTAPP_COMPOSE) down
|
||||
@echo "productapp stack is up."
|
||||
|
||||
productapp-up-logs:
|
||||
@echo "Building and starting productapp full stack..."
|
||||
docker compose --env-file $(PRODUCTAPP_ENV) -f $(PRODUCTAPP_COMPOSE) up --build
|
||||
|
|
|
|||
|
|
@ -5,14 +5,15 @@ FROM ${GO_IMAGE_NAME}:${GO_IMAGE_VERSION}
|
|||
ENV GOPROXY=https://package-mirror.liara.ir/repository/go/
|
||||
ENV GOSUMDB=off
|
||||
|
||||
|
||||
|
||||
WORKDIR /home/app
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
COPY . .
|
||||
RUN go build -mod=mod -o /bin/productapp cmd/productapp/main.go
|
||||
RUN go install github.com/air-verse/air@latest
|
||||
|
||||
CMD ["/bin/productapp", "serve"]
|
||||
RUN printf '#!/bin/sh\n./cmd/productapp/temp/main migrate --up\nexec ./cmd/productapp/temp/main serve\n' > /entrypoint.sh && chmod +x /entrypoint.sh
|
||||
|
||||
COPY . .
|
||||
|
||||
CMD ["air", "-c", "/home/app/.air/.air.productapp.toml"]
|
||||
|
|
@ -9,7 +9,8 @@ services:
|
|||
container_name: productapp-app
|
||||
ports:
|
||||
- "8080:8080"
|
||||
command: /bin/sh -c "/bin/productapp migrate --up && /bin/productapp serve"
|
||||
volumes:
|
||||
- ../../..:/home/app
|
||||
environment:
|
||||
DB_HOST: productapp-mysql
|
||||
DB_USERNAME: root
|
||||
|
|
|
|||
Loading…
Reference in New Issue