155 lines
3.4 KiB
Markdown
155 lines
3.4 KiB
Markdown
# Just Build System
|
|
|
|
A modular build system using Just that supports container builds, Python tooling, and more.
|
|
|
|
## Installation
|
|
|
|
There are several ways to use this build system:
|
|
|
|
### Method 1: Global Installation with Symlinks
|
|
|
|
1. Clone this repository to a permanent location:
|
|
```bash
|
|
git clone https://github.com/yourusername/wjust ~/.wjust
|
|
```
|
|
|
|
2. In your project, create the module directories and symlink the justfiles:
|
|
```bash
|
|
# Create module directories
|
|
mkdir -p container python
|
|
|
|
# Create symlinks to the global justfiles
|
|
ln -s ~/.wjust/container/justfile container/justfile
|
|
ln -s ~/.wjust/python/justfile python/justfile
|
|
```
|
|
|
|
3. Create your project's `justfile`:
|
|
```makefile
|
|
# Import modules
|
|
mod container
|
|
mod python
|
|
|
|
# Override or add project-specific recipes here
|
|
default:
|
|
@just --list
|
|
```
|
|
|
|
4. Create required files:
|
|
```bash
|
|
# For container module
|
|
echo "registry.example.com/myproject" > container/name
|
|
|
|
# Optional: Set version
|
|
echo "0.1.0" > version
|
|
# Or use __about__.py with __version__ = "0.1.0"
|
|
```
|
|
|
|
### Method 2: Local Copy (Traditional)
|
|
|
|
Copy the entire module directories to your project:
|
|
```bash
|
|
cp -r ~/.wjust/container ~/.wjust/python .
|
|
```
|
|
|
|
Then create your `justfile` as shown above.
|
|
|
|
### Method 3: Remote Import (Advanced)
|
|
|
|
For advanced users who want to pull updates directly from the repository:
|
|
|
|
```bash
|
|
# Create a script to update modules
|
|
cat > update-just-modules.sh << 'EOF'
|
|
#!/bin/bash
|
|
REPO="https://raw.githubusercontent.com/yourusername/wjust/main"
|
|
mkdir -p {container,python}
|
|
curl -o container/justfile "$REPO/container/justfile"
|
|
curl -o python/justfile "$REPO/python/justfile"
|
|
EOF
|
|
|
|
chmod +x update-just-modules.sh
|
|
```
|
|
|
|
Then run `./update-just-modules.sh` whenever you want to update the modules.
|
|
|
|
## Quick Start
|
|
|
|
1. Choose an installation method from above
|
|
2. Run `just` to see available commands:
|
|
```bash
|
|
just
|
|
|
|
Available recipes:
|
|
container ... # Container management
|
|
python ... # Python tools
|
|
```
|
|
|
|
## Container Module
|
|
|
|
The container module provides standardized container building and deployment.
|
|
|
|
### Setup
|
|
|
|
1. Create a `container/name` file with your container registry path:
|
|
```
|
|
registry.example.com/myproject
|
|
```
|
|
|
|
2. Version will be detected from (in order):
|
|
- Any `__about__.py` file containing `__version__ = "x.y.z"`
|
|
- A `version` file in the project root
|
|
- Defaults to "0.0.0" if neither exists
|
|
|
|
3. Create your `container/Containerfile`:
|
|
```dockerfile
|
|
FROM python:3.11
|
|
# Add your container configuration
|
|
```
|
|
|
|
### Usage
|
|
|
|
```bash
|
|
# Show available commands
|
|
just
|
|
|
|
# Build container
|
|
just container build
|
|
|
|
# Push container to registry
|
|
just container deploy
|
|
```
|
|
|
|
### Customization
|
|
|
|
The container module provides these recipes:
|
|
- `build`: Builds the container with version tag
|
|
- `deploy`: Pushes the container to the registry
|
|
|
|
## Python Module
|
|
|
|
The Python module provides linting with Ruff.
|
|
|
|
### Usage
|
|
|
|
```bash
|
|
# Run linter
|
|
just python lint
|
|
|
|
# Run linter with auto-fix
|
|
just python lint-fix
|
|
```
|
|
|
|
## Adding New Modules
|
|
|
|
1. Create a new directory for your module
|
|
2. Add a `justfile` in the module directory
|
|
3. Import it in your root `justfile` with `mod mymodule`
|
|
|
|
## Environment Variables
|
|
|
|
- `VERSION`: Automatically set from `__about__.py` or `version` file
|
|
- `CONTAINER_NAME`: Set from `container/name` file
|
|
|
|
## Contributing
|
|
|
|
Feel free to submit issues and pull requests for additional modules or improvements.
|