-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: docker * fix: ignore txt files * chore: readme * fix: vet * fix: test * fix: test * chore: gen * fix * chore: upgrade go
- Loading branch information
Showing
23 changed files
with
319 additions
and
222 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,59 @@ | ||
APP_NAME ?= app | ||
|
||
.PHONY: vet | ||
vet: | ||
go vet ./... | ||
|
||
.PHONY: staticcheck | ||
staticcheck: | ||
staticcheck ./... | ||
|
||
.PHONY: test | ||
test: | ||
go test -race -v -timeout 30s ./... | ||
|
||
.PHONY: tailwind-watch | ||
tailwind-watch: | ||
./tailwindcss -i ./static/css/input.css -o ./static/css/style.css --watch | ||
tailwindcss -i ./static/css/input.css -o ./static/css/style.css --watch | ||
|
||
.PHONY: tailwind-build | ||
tailwind-build: | ||
./tailwindcss -i ./static/css/input.css -o ./static/css/style.min.css --minify | ||
|
||
.PHONY: templ-generate | ||
templ-generate: | ||
templ generate | ||
tailwindcss -i ./static/css/input.css -o ./static/css/style.min.css --minify | ||
|
||
.PHONY: templ-watch | ||
templ-watch: | ||
templ generate --watch | ||
|
||
.PHONY: templ-generate | ||
templ-generate: | ||
templ generate | ||
|
||
.PHONY: dev | ||
dev: | ||
go build -o ./tmp/$(APP_NAME) ./cmd/$(APP_NAME)/main.go && air | ||
go build -o ./tmp/main ./cmd/main.go && air | ||
|
||
.PHONY: build | ||
build: | ||
make tailwind-build | ||
make templ-generate | ||
go build -ldflags "-X main.Environment=production" -o ./bin/$(APP_NAME) ./cmd/$(APP_NAME)/main.go | ||
go build -ldflags "-X main.Environment=production" -o ./bin/$(APP_NAME) ./cmd/main.go | ||
|
||
.PHONY: vet | ||
vet: | ||
go vet ./... | ||
.PHONY: docker-build | ||
docker-build: | ||
docker-compose -f ./dev/docker-compose.yml build | ||
|
||
.PHONY: staticcheck | ||
staticcheck: | ||
staticcheck ./... | ||
.PHONY: docker-up | ||
docker-up: | ||
docker-compose -f ./dev/docker-compose.yml up | ||
|
||
.PHONY: test | ||
test: | ||
go test -race -v -timeout 30s ./... | ||
.PHONY: docker-dev | ||
docker-dev: | ||
docker-compose -f ./dev/docker-compose.yml -f ./dev/docker-compose.dev.yml up | ||
|
||
.PHONY: docker-down | ||
docker-down: | ||
docker-compose -f ./dev/docker-compose.yml down | ||
|
||
.PHONY: docker-clean | ||
docker-clean: | ||
docker-compose -f ./dev/docker-compose.yml down -v --rmi all |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
FROM golang:1.23-alpine | ||
WORKDIR /app | ||
|
||
RUN apk add --no-cache make gcc g++ curl | ||
|
||
RUN go install github.com/a-h/templ/cmd/templ@latest && \ | ||
go install github.com/air-verse/air@latest | ||
|
||
RUN curl -sLO https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-linux-x64 && \ | ||
chmod +x tailwindcss-linux-x64 && \ | ||
mv tailwindcss-linux-x64 /usr/local/bin/tailwindcss | ||
|
||
COPY dev/scripts/entrypoint.sh /usr/local/bin/ | ||
RUN chmod +x /usr/local/bin/entrypoint.sh | ||
|
||
ENTRYPOINT ["entrypoint.sh"] |
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,9 @@ | ||
version: '3.8' | ||
services: | ||
app: | ||
volumes: | ||
- ..:/app | ||
environment: | ||
- ENVIRONMENT=development | ||
ports: | ||
- "4000:4000" |
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,12 @@ | ||
# ./dev/docker-compose.yml (Base configuration) | ||
version: '3.8' | ||
services: | ||
app: | ||
build: | ||
context: .. | ||
dockerfile: dev/Dockerfile | ||
ports: | ||
- "4000:4000" | ||
environment: | ||
- ENVIRONMENT=production | ||
|
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,20 @@ | ||
#!/bin/sh | ||
set -e # Exit on error | ||
|
||
cd /app | ||
|
||
if [ "$ENVIRONMENT" = "development" ]; then | ||
echo "Starting in development mode..." | ||
|
||
echo "Starting dev server..." | ||
air & | ||
|
||
echo "Starting templ watch..." | ||
make templ-watch & | ||
|
||
wait | ||
else | ||
echo "Starting in production mode..." | ||
make build | ||
./bin/app | ||
fi |
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,12 @@ | ||
#!/bin/sh | ||
set -e # Exit on error | ||
|
||
cd /app | ||
|
||
if [ "$ENVIRONMENT" = "development" ]; then | ||
make tailwind-watch | ||
make templ-watch | ||
else | ||
make tailwind-build | ||
make templ-generate | ||
fi |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Oops, something went wrong.