Process docker-compose.yml to TMPDIR before copying to read-only output

This commit is contained in:
UGA Innovation Factory
2025-12-18 19:06:11 -05:00
parent 1af1532e72
commit 594a2a97d5

View File

@@ -58,13 +58,18 @@ let
echo "Source directory contents:"
ls -la $src/ || true
# Copy all application files using rsync, excluding files we'll modify
${pkgs.rsync}/bin/rsync -av --exclude='.git' --exclude='docker-compose.yml' --exclude='.env' --exclude='management-dashboard-web-app/.env' $src/ $out/opt/usda-vision/
# Process docker-compose.yml with sed and write directly to destination
# Process docker-compose.yml first and create it in a temp location
if [ -f $src/docker-compose.yml ]; then
${pkgs.gnused}/bin/sed 's|env_file:.*management-dashboard-web-app/\.env|env_file: /var/lib/usda-vision/.env|g; s|\./management-dashboard-web-app/\.env|/var/lib/usda-vision/.env|g' \
$src/docker-compose.yml > $out/opt/usda-vision/docker-compose.yml
$src/docker-compose.yml > $TMPDIR/docker-compose.yml
fi
# Copy all application files using rsync, excluding files we'll provide separately
${pkgs.rsync}/bin/rsync -av --exclude='.git' --exclude='docker-compose.yml' --exclude='.env' --exclude='management-dashboard-web-app/.env' $src/ $out/opt/usda-vision/
# Copy the processed docker-compose.yml
if [ -f $TMPDIR/docker-compose.yml ]; then
cp $TMPDIR/docker-compose.yml $out/opt/usda-vision/docker-compose.yml
fi
# Verify files were copied