Nixius
/
template
Template
2
1
Fork 1

Set up Docker configuration with Alpine minimal image and fix test script paths

This commit is contained in:
Leopere 2025-04-23 10:28:13 -04:00
parent dfe71e35eb
commit 3e4224b1bf
5 changed files with 57 additions and 15 deletions

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