Process docker-compose.yml during copy instead of modifying after
This commit is contained in:
17
default.nix
17
default.nix
@@ -58,24 +58,17 @@ let
|
||||
echo "Source directory contents:"
|
||||
ls -la $src/ || true
|
||||
|
||||
# Copy all application files using rsync to preserve everything
|
||||
${pkgs.rsync}/bin/rsync -av --exclude='.git' $src/ $out/opt/usda-vision/
|
||||
# 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/
|
||||
|
||||
# Verify files were copied
|
||||
echo "Destination directory contents:"
|
||||
ls -la $out/opt/usda-vision/ || true
|
||||
|
||||
# Remove any existing .env files
|
||||
rm -f $out/opt/usda-vision/management-dashboard-web-app/.env
|
||||
rm -f $out/opt/usda-vision/.env
|
||||
|
||||
# Update docker-compose.yml to use /var/lib/usda-vision/.env
|
||||
# Use temp file in /tmp and remove old file before moving
|
||||
if [ -f $out/opt/usda-vision/docker-compose.yml ]; then
|
||||
# Process docker-compose.yml with sed and write directly to destination
|
||||
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' \
|
||||
$out/opt/usda-vision/docker-compose.yml > /tmp/docker-compose.yml.tmp
|
||||
rm $out/opt/usda-vision/docker-compose.yml
|
||||
mv /tmp/docker-compose.yml.tmp $out/opt/usda-vision/docker-compose.yml
|
||||
$src/docker-compose.yml > $out/opt/usda-vision/docker-compose.yml
|
||||
fi
|
||||
|
||||
# Create convenience scripts
|
||||
|
||||
Reference in New Issue
Block a user