Skip to content

Instantly share code, notes, and snippets.

@sachith-1
Last active April 27, 2022 10:56
Show Gist options
  • Save sachith-1/c80d11bdfdc2575761429f3054816000 to your computer and use it in GitHub Desktop.
Save sachith-1/c80d11bdfdc2575761429f3054816000 to your computer and use it in GitHub Desktop.
bash script for docker builder pattern demo
#!/bin/bash
echo building image node_project:build
docker build -t node_project:build -f Dockerfile.build .
# create a new container from the image and copy dist folder content to distapp folder
docker create --name copyContainer node_project:build
docker cp copyContainer:/usr/src/app/dist ./distapp
docker rm -f copyContainer
echo building image node_project:prod
docker build -t node_project:prod -f Dockerfile.prod .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment