Skip to content

Commit ccb74b3

Browse files
Copilotnpv2k1
andcommitted
Add Makefile, docker workflow, envrc, and improve gitignore
Co-authored-by: npv2k1 <[email protected]>
1 parent f6d91b1 commit ccb74b3

File tree

5 files changed

+123
-1
lines changed

5 files changed

+123
-1
lines changed

.envrc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Automatically use Nix flakes when entering this directory
2+
# Install direnv and run: direnv allow
3+
4+
use flake
5+
6+
# Optional: Set additional environment variables
7+
# export DATABASE_URL="todo.db"
8+
# export RUST_BACKTRACE="1"

.github/workflows/docker.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Docker Build
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
jobs:
10+
docker-build:
11+
name: Docker Build Test
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Set up Docker Buildx
17+
uses: docker/setup-buildx-action@v3
18+
19+
- name: Build Docker image
20+
uses: docker/build-push-action@v5
21+
with:
22+
context: .
23+
push: false
24+
tags: template-rust:test
25+
cache-from: type=gha
26+
cache-to: type=gha,mode=max
27+
28+
- name: Test Docker image
29+
run: |
30+
docker run --rm template-rust:test --version || echo "Version command not available"
31+
docker run --rm template-rust:test --help
32+
33+
docker-compose:
34+
name: Docker Compose Validation
35+
runs-on: ubuntu-latest
36+
steps:
37+
- uses: actions/checkout@v4
38+
39+
- name: Validate docker-compose.yml
40+
run: docker compose config > /dev/null

.gitignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,31 @@
1+
# Rust build artifacts
12
/target
3+
Cargo.lock.bak
4+
5+
# Database files
26
*.db
37
*.db-*
8+
*.sqlite
9+
*.sqlite3
10+
11+
# Environment files
412
.env
13+
.env.*
14+
!.envrc
15+
16+
# macOS
517
.DS_Store
18+
19+
# IDE
20+
.idea/
21+
*.swp
22+
*.swo
23+
*~
24+
25+
# Docker data
26+
data/
27+
28+
# Nix
29+
result
30+
result-*
31+
.direnv/

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Multi-stage build for minimal final image
2-
FROM rust:1.75-slim as builder
2+
FROM rust:1.83-slim AS builder
33

44
# Install build dependencies
55
RUN apt-get update && apt-get install -y \

Makefile

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
.PHONY: help build test clean docker-build docker-run docker-compose-up docker-compose-down
2+
3+
help: ## Show this help message
4+
@echo 'Usage: make [target]'
5+
@echo ''
6+
@echo 'Available targets:'
7+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}'
8+
9+
build: ## Build the project in debug mode
10+
cargo build
11+
12+
build-release: ## Build the project in release mode
13+
cargo build --release
14+
15+
test: ## Run all tests
16+
cargo test
17+
18+
test-verbose: ## Run tests with verbose output
19+
cargo test -- --nocapture
20+
21+
clippy: ## Run clippy linter
22+
cargo clippy -- -D warnings
23+
24+
fmt: ## Format code
25+
cargo fmt
26+
27+
fmt-check: ## Check code formatting
28+
cargo fmt --all -- --check
29+
30+
clean: ## Clean build artifacts
31+
cargo clean
32+
33+
docker-build: ## Build Docker image
34+
docker build -t template-rust:latest .
35+
36+
docker-run: ## Run Docker container in TUI mode
37+
docker run --rm -it -v $(PWD)/data:/app/data template-rust:latest tui
38+
39+
docker-compose-up: ## Start services with docker-compose
40+
docker compose up
41+
42+
docker-compose-down: ## Stop services with docker-compose
43+
docker compose down
44+
45+
docker-compose-dev: ## Start development service with docker-compose
46+
docker compose up dev
47+
48+
all: fmt clippy test build ## Run format, clippy, test, and build

0 commit comments

Comments
 (0)