Skip to content

Instantly share code, notes, and snippets.

@ziedHamdi
Created September 15, 2021 10:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ziedHamdi/8cc07d540a0b9b0005c95890781cd037 to your computer and use it in GitHub Desktop.
Save ziedHamdi/8cc07d540a0b9b0005c95890781cd037 to your computer and use it in GitHub Desktop.
build docker images from git repositories
#!/bin/sh
# GRAPHQL_SERVER_VERSION=$1
# NEXT_SERVER_VERSION=$2
# set variables from .env to system: https://gist.github.com/mihow/9c7f559807069a03e302605691f85572
if [ -f .env ]
then
export $(cat .env | sed 's/#.*//g' | xargs)
fi
echo Building version $GRAPHQL_SERVER_VERSION of backend and version $NEXT_SERVER_VERSION of frontend
if [ -z $GRAPHQL_SERVER_VERSION ]
then
echo you didn''t specify the tag for then BACKEND git repository
exit
fi
if [ -z $NEXT_SERVER_VERSION ]
then
echo you didn''t specify the tag for then FRONTEND git repository
exit
fi
cd ..
rm -rf weallyback
git clone --depth 1 --branch $GRAPHQL_SERVER_VERSION https://1vu@bitbucket.org/1vu/weallyback.git
cd weallyback
# > prod/weallyback/
echo building doker image for backend server
pwd
docker build . -t graphql:$GRAPHQL_SERVER_VERSION
cd ..
rm -rf weally.org
git clone --depth 1 --branch $NEXT_SERVER_VERSION https://1vu@bitbucket.org/1vu/weally.org.git
cd weally.org
# > prod/weally.org/
echo building doker image for fronted server
pwd
docker build . -t frontend:$NEXT_SERVER_VERSION
cd ..
# > prod/
cp ./weally_conf/docker-compose.yml .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment