-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4b35096
commit 9491bc2
Showing
9 changed files
with
147 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
RED=`tput setaf 1` | ||
GREEN=`tput setaf 2` | ||
WHITE=`tput setaf 7` | ||
RESET=`tput sgr0` | ||
|
||
ORG_PATH := $(CURDIR) | ||
|
||
PG_HOST := localhost | ||
PG_USER := testuser | ||
PG_PASSWORD := testpassword | ||
PG_DBNAME := testdb | ||
PG_PORT := 5432 | ||
PG_SSLMODE := disable | ||
|
||
ENVS = \ | ||
export PG_HOST=$(PG_HOST); \ | ||
export PG_USER=$(PG_USER); \ | ||
export PG_PASSWORD=$(PG_PASSWORD); \ | ||
export PG_DBNAME=$(PG_DBNAME); \ | ||
export PG_PORT=$(PG_PORT); \ | ||
export PG_SSLMODE=$(PG_SSLMODE); | ||
|
||
.PHONY: server | ||
server: ## Run Application | ||
@$(ENVS) docker-compose up --build | ||
|
||
.PHONY: stop | ||
stop: ## Stop the servers | ||
@$(ENVS) docker-compose down | ||
|
||
.PHONY: help | ||
help: ## Display this help screen | ||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \ | ||
sed 's/Makefile://' | \ | ||
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
FROM golang:1.22.5-alpine3.20 AS builder | ||
|
||
RUN apk add --no-cache git | ||
RUN go install github.com/pressly/goose/v3/cmd/goose@latest | ||
|
||
WORKDIR /app | ||
|
||
COPY go.mod go.sum ./ | ||
|
||
RUN go mod download | ||
|
||
COPY . . | ||
|
||
RUN go build -o main . | ||
|
||
FROM alpine:latest | ||
|
||
RUN apk --no-cache add ca-certificates git | ||
|
||
COPY --from=builder /go/bin/goose /usr/local/bin/ | ||
|
||
WORKDIR /root/ | ||
|
||
COPY ./db ./db | ||
|
||
COPY --from=builder /app/main . | ||
|
||
EXPOSE 1323 | ||
|
||
CMD ["./main"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters