60 lines
No EOL
2.3 KiB
Makefile
60 lines
No EOL
2.3 KiB
Makefile
# Builds a debug container and runs it
|
|
dev: start-debug
|
|
@echo "Cd into client and run 'npm run dev' to start the client in dev mode."
|
|
|
|
# Builds a debug container
|
|
[private]
|
|
build-container-server-debug:
|
|
podman build -t fb-server-debug -f container/ContainerfileDebug .
|
|
|
|
# Builds a debug container and runs it
|
|
[private]
|
|
start-debug: start-postgres-dev clean-podman init-sqlx build-container-server-debug
|
|
podman network create fb_network --ignore
|
|
podman run -d --network fb_network -e DATABASE_URL=postgres://postgres:password@postgres:5432/frostbyte -p 8080:8080 --name frostbyte-debug fb-server-debug
|
|
@echo "Debug server started."
|
|
|
|
# Builds a release container
|
|
[private]
|
|
build-container-release:
|
|
podman build -t fb-server -f container/Containerfile .
|
|
|
|
# Builds a release container and runs it
|
|
start-release: start-postgres-dev clean-podman init-sqlx build-container-release
|
|
podman network create fb_network --ignore
|
|
podman run -d --network fb_network -e DATABASE_URL=postgres://postgres:password@postgres:5432/frostbyte -p 8080:8080 --name frostbyte fb-server
|
|
|
|
# Initializes the database, runs migrations and then prepares sqlx
|
|
init-sqlx:
|
|
echo "DATABASE_URL=postgres://postgres:password@localhost:5432/frostbyte" > server/.env
|
|
cd server && sqlx database create --connect-timeout 40 # Postgres takes a while to start up
|
|
cd server && sqlx migrate run --source migrations_pg
|
|
cd server && cargo sqlx prepare
|
|
|
|
# Starts a postgres container for development
|
|
[private]
|
|
start-postgres-dev:
|
|
podman rm -f postgres
|
|
podman run --network fb_network --name postgres -e POSTGRES_PASSWORD=password -d -p 5432:5432 docker.io/postgres:16.1-alpine
|
|
|
|
# Forcefully stops and removes the frostbyte container
|
|
[private]
|
|
clean-podman:
|
|
podman container rm -f frostbyte
|
|
podman container rm -f frostbyte-debug
|
|
|
|
# Forcefully removes the frostbyte images
|
|
[private]
|
|
clean-images:
|
|
podman image rm -f fb-server
|
|
podman image rm -f fb-server-debug
|
|
|
|
# Cleans up everything related to the project
|
|
clean: clean-podman clean-images
|
|
rm -rf client/dist
|
|
rm -rf client/node_modules
|
|
rm -rf client-solid/dist
|
|
rm -rf client-solid/node_modules
|
|
rm -rf server/public
|
|
rm -rf server/target
|
|
@echo "Cleaned up! Make sure to clean up podman volumes and networks."
|