forked from MechLizard/The-Feed
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker_compile_script.sh
32 lines (25 loc) · 1.04 KB
/
docker_compile_script.sh
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
#!/bin/bash
# Stop any previous instances
echo "Stopping previous the-feed containers..."
docker stop the-feed
# Remove the old container to avoid conflicts
docker rm the-feed
# Pull the docker image
echo "Downloading docker image..."
docker pull mechlizard/the-feed-web:latest
# Create a container from the image
echo "Creating container..."
docker create -p 3000:3000 -p 8000:8000 -p 27017:27017 -e MONGO_URL=mongodb://the-feed-mongodb-1:27017/MERN --name the-feed mechlizard/the-feed-web:latest
# Copy files from the current directory to the container
echo "Copying project files..."
docker cp ./MERN the-feed:/home/circleci/project/MERN
docker cp ./public the-feed:/home/circleci/project/public
docker cp ./src the-feed:/home/circleci/project/src
docker cp ./test the-feed:/home/circleci/project/test
docker cp ./package.json the-feed:/home/circleci/project
docker cp ./package-lock.json the-feed:/home/circleci/project
# Start the container
echo "Starting the container..."
docker start the-feed
# Run the container and follow logs
docker logs -f the-feed