sophia.events/bin/1-build.sh
2018-02-15 13:32:56 +01:00

20 lines
641 B
Bash
Executable file

# Copy resources needed in the image build phase
cp ../template/index.mustache ../data/*.* ../www/
# Build image
cd ../www
docker image build -t lucj/sophia.events .
# Run website
ID=$(docker run -d -p 80 lucj/sophia.events)
# Copy generated index.html and past.html locally
docker cp $ID:/usr/share/nginx/html/index.html .
docker cp $ID:/usr/share/nginx/html/past.html .
# Remove files used for image build
rm index.mustache events.json clean_events.js package.json
# Get port
PORT=$(docker inspect --format '{{ (index (index .NetworkSettings.Ports "80/tcp") 0).HostPort }}' $ID)
echo "=> web site available on http://localhost:$PORT"