First, if you don't have the Docker installed, you can do it clicking here - to open in a new tab, press CMD(Mac) or CTRL(Win) and click - download and install it. We'll need it to go further.
While you wait the download, let's create some aliases to help you with most repetitive commands
dexec() {
docker exec -it $1 sh -c $2
}
alias ownership='sudo chown -R $USER:$USER .' # run it if you see a permission denied error
alias app-init='sh init.sh' # run to create the enviroment
alias app-start='sh start.sh' # run every time you want to start the app.
# It will run migrations and gem or packegesinstalations
To run commands inside your container, you can run dexec
, passing the container name as first parameter and the command at the end.
๐จ Alert: Don't forget the quotes!
Exemples:
dexec container-name 'rails db:create db:migrate db:seed'
dexec container-name 'rails c'
If you are running Docker on Linux, the files rails new
created are owned by
root. This happens because the container runs as the root user. If this is the
case, after adding it to your zshrc, you can use this alias to change the ownership of the new files.
ownership
Go to the directory you want to clone the project and run
git clone [email protected]:jucaesmanhoto/design-auctions.git
Navigate into the new directory
cd design-auctions
If the docker is installed, you can build the enviroment and create the development database by running
app-init
Now, you can just run the app and start working :)
app-start