-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathfetch_shops.sh
More file actions
executable file
·38 lines (28 loc) · 1.08 KB
/
Copy pathfetch_shops.sh
File metadata and controls
executable file
·38 lines (28 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
# Define an array of versions
versions=("6.7.0.1" "6.7.1.2" "6.7.2.2" "6.7.3.1")
# Loop through each version
for version in "${versions[@]}"; do
# Check if directory already exists
if [ -d "./shops/$version" ]; then
echo "Skipping version $version - directory already exists"
continue
fi
echo "Processing version $version..."
# Define image name
image_name="dockware/dev:$version"
# Pull the Docker image
docker pull "$image_name"
# Start a temporary container
container_id=$(docker run -d --rm "$image_name" tail -f /dev/null)
# Create target directory for shop files
mkdir -p "./shops/$version"
# Copy files from container to host
docker cp "$container_id:/var/www/html/." "./shops/$version"
# Stop and remove the container
docker stop "$container_id"
# Change ownership of the copied files to the current user
sudo chown -R $(whoami):$(whoami) "./shops/$version"
echo "Completed processing for version $version"
done
echo "All versions processed successfully."