Nixius
/
template
Template
2
1
Fork 1

Compare commits

...

2 Commits

8 changed files with 139 additions and 22 deletions

View File

@ -1,5 +0,0 @@
---
description:
globs:
alwaysApply: false
---

View File

@ -1,5 +1,38 @@
---
description:
globs:
description:
globs:
alwaysApply: false
---
# Gitignore Rules
The [.gitignore](mdc:.gitignore) file controls which files are tracked by Git.
## Key Patterns
- Cruft files (temporary/generated files) should always be ignored
- The `./temp` directory should exist in the repository
- Contents of `./temp` should be ignored (except for `.gitkeep`)
## Standard Cruft Files to Ignore
- `*.log` - Log files
- `*.tmp`, `*.bak` - Temporary and backup files
- `*.swp`, `*.swo` - Vim swap files
- `*.pyc`, `__pycache__/` - Python bytecode
- `node_modules/` - Node.js dependencies
- `dist/`, `build/` - Build output directories
- `*.DS_Store`, `Thumbs.db` - OS-specific files
## Temp Directory Setup
```gitignore
# Allow temp directory but ignore its contents
./temp/*
!./temp/.gitkeep
```
## Important Guidelines
- When adding files to a previously empty directory with a `.gitkeep`, remove the `.gitkeep` file
- Never commit sensitive data, temporary build artifacts, or large binary files
- Keep the temp directory clean by only using it for local testing

View File

@ -0,0 +1,47 @@
---
description:
globs:
alwaysApply: false
---
# .gitkeep File Handling
## Purpose of .gitkeep
The `.gitkeep` file is a convention (not a Git feature) used to:
- Track otherwise empty directories in Git
- Ensure important directory structures are maintained
- Placeholder for directories that will contain files in the future
## Important Rule
**When adding content to a directory that contains a `.gitkeep` file, you should delete the `.gitkeep` file.**
```bash
# Example workflow when adding content to a previously empty directory
# 1. Check if .gitkeep exists
if [ -f directory/.gitkeep ]; then
# 2. Remove it when adding actual content
rm directory/.gitkeep
fi
# 3. Add your files
touch directory/your-new-file.txt
# 4. Commit both changes together
git add directory/
git commit -m "Add content to directory and remove .gitkeep"
```
## Why Remove .gitkeep?
- `.gitkeep` serves no purpose once a directory contains files
- Leaving it creates confusion about the directory's status
- Proper cleanup maintains a clean repository
## Locations with .gitkeep
In this project, the following locations may contain `.gitkeep` files:
- [temp/.gitkeep](mdc:temp/.gitkeep) - Keeps the temp directory in the repo
- [docker/template/src/.gitkeep](mdc:docker/template/src/.gitkeep) - Keeps the source directory in the repo
Always check for `.gitkeep` when adding files to these directories and remove it if found.

View File

@ -5,22 +5,9 @@ services:
context: ./docker/template
dockerfile: Dockerfile
image: template:dev
ports:
- "3000:3000"
volumes:
- ./docker/template/src:/app/src
- ./temp:/app/temp
environment:
- NODE_ENV=development
- DEBUG=true
- LOG_LEVEL=debug
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
interval: 30s
timeout: 5s
retries: 3
start_period: 10s
- ./docker/template/src:/scratch
- ./temp:/temp
networks:
- dev_network

12
docker-compose.test.yml Normal file
View File

@ -0,0 +1,12 @@
# Test configuration
services:
template:
build:
context: ./docker/template
dockerfile: Dockerfile
image: template:test
volumes:
- ./docker/template/src:/scratch
- ./temp:/temp
# Since scratch can't run commands, we use a dummy entrypoint
entrypoint: "true"

View File

@ -0,0 +1,10 @@
FROM alpine:3.18
# Create directories for volume mounts
RUN mkdir -p /scratch /temp
# Set working directory
WORKDIR /scratch
# Simple command to keep container running
CMD ["tail", "-f", "/dev/null"]

View File

@ -0,0 +1 @@
FROM git.nixc.us/nixius/template:staging

32
tests/run_tests.sh Executable file
View File

@ -0,0 +1,32 @@
#!/bin/bash
# Create temp directory if it doesn't exist
mkdir -p ./temp
# Run tests and capture output
echo "Running tests..."
echo "Test started at $(date)" > ./temp/test_output.log
# Example test commands
echo "Testing Docker build..." >> ./temp/test_output.log
docker compose -f docker-compose.test.yml build >> ./temp/test_output.log 2>&1
echo "Testing container startup..." >> ./temp/test_output.log
docker compose -f docker-compose.test.yml up -d >> ./temp/test_output.log 2>&1
# Wait for container to be ready
sleep 5
# Check container status
echo "Container status:" >> ./temp/test_output.log
docker compose -f docker-compose.test.yml ps >> ./temp/test_output.log 2>&1
# Clean up
echo "Cleaning up..." >> ./temp/test_output.log
docker compose -f docker-compose.test.yml down >> ./temp/test_output.log 2>&1
echo "Tests completed at $(date)" >> ./temp/test_output.log
# Display results
echo "Test results have been saved to ./temp/test_output.log"
cat ./temp/test_output.log