zdravko/justfile

74 lines
1.9 KiB
Makefile
Raw Normal View History

2024-02-10 17:05:11 +00:00
# Always use devbox environment to run commands.
set shell := ["devbox", "run"]
# Load dotenv
set dotenv-load
2024-02-10 17:05:11 +00:00
# Load public and private keys
export JWT_PRIVATE_KEY := `cat jwt.private.pem`
export JWT_PUBLIC_KEY := `cat jwt.public.pem`
2024-02-18 07:51:05 +00:00
GIT_SHA := `git rev-parse --short HEAD`
DOCKER_IMAGE := "ghcr.io/mentos1386/zdravko:sha-"+GIT_SHA
2024-02-12 08:25:11 +00:00
STATIC_DIR := "./web/static"
2024-02-16 21:31:00 +00:00
# Build the application
build:
2024-02-18 07:51:05 +00:00
docker build -f build/Dockerfile -t {{DOCKER_IMAGE}} .
2024-02-16 21:31:00 +00:00
# Run Docker application.
2024-02-18 10:34:03 +00:00
run-docker:
docker run -p 8080:8080 \
-e SESSION_SECRET \
-e OAUTH2_CLIENT_ID \
-e OAUTH2_CLIENT_SECRET \
-e OAUTH2_ENDPOINT_TOKEN_URL \
-e OAUTH2_ENDPOINT_AUTH_URL \
-e OAUTH2_ENDPOINT_USER_INFO_URL \
-e OAUTH2_ENDPOINT_LOGOUT_URL \
{{DOCKER_IMAGE}}
2024-02-11 10:56:21 +00:00
# Run full development environment
run:
devbox services up
run-worker:
go build -o dist/zdravko cmd/zdravko/main.go
./dist/zdravko --worker=true --server=false --temporal=false
# Generates new jwt key pair
generate-jwt-key:
openssl genrsa -out jwt.private.pem 2048
openssl rsa -pubout -in jwt.private.pem -out jwt.public.pem
2024-02-16 21:31:00 +00:00
# Start zdravko
run-zdravko:
go build -o dist/zdravko cmd/zdravko/main.go
./dist/zdravko --worker=false
2024-02-11 09:15:00 +00:00
# Deploy the application to fly.io
deploy:
2024-02-18 09:54:01 +00:00
fly deploy --ha=false -c deploy/fly.toml -i {{DOCKER_IMAGE}}
2024-02-11 10:56:21 +00:00
# Start devbox shell
shell:
devbox shell
# Generate and download all external dependencies.
generate:
rm -rf internal/models/query/*
2024-02-11 10:56:21 +00:00
go generate ./...
_tailwindcss-build:
2024-02-16 21:31:00 +00:00
tailwindcss build -c build/tailwind.config.js -i {{STATIC_DIR}}/css/main.css -o {{STATIC_DIR}}/css/tailwind.css
2024-02-11 10:56:21 +00:00
_htmx-download:
mkdir -p {{STATIC_DIR}}/js
curl -sLo {{STATIC_DIR}}/js/htmx.min.js https://unpkg.com/htmx.org/dist/htmx.min.js
_feather-icons-download:
mkdir -p {{STATIC_DIR}}/icons
curl -sLo {{STATIC_DIR}}/icons/feather-sprite.svg https://unpkg.com/feather-icons/dist/feather-sprite.svg
_generate-gorm:
go run tools/generate/main.go