This repository is a result of my process of using docker to complete the howtographql.com without installing node, prisma, prisma-cli, or anything other than docker and git locally.
Instead, I use docker containers with the prisma-cli installed, and mount them to my local working directory to execute prisma commands.
My process was generally thus:
I've created tags for what your docker-compose
and project should look like
at the completion of each of the chapters from howtographql.com.
You can view those tags on the releases page of this repo.
First, I built an image from node:latest
and basically ran npm i -g prisma
on it.
You can either copy my Dockerfile, and run docker build -t prisma .
,
or you can use my published image by pulling docker pull longlivechief/prisma
.
Building yourself will guarantee the latest prisma-cli, and will be shorter to type if you skip the wrapper scripts step and opt to run the full docker commands by hand.
This step is optional, but will save you a lot of typing. I use docker to execute
prisma
and npm
commands. (howtographql still uses yarn
but you can substitute
yarn
for npm
in the steps below if you want).
The wrapper script will also give you the "native" feel and allow you to follow along
with the tutorials as if prisma
and npm
were natively installed, so I highly recommend
creating these wrappers/aliases. If you choose not to, simply run the docker run
commmand
from each script by hand each time you want to run prisma <command>
or npm <command
.
Copy or clone the two scripts in /bin
of this project somewhere onto your $PATH
. For this
example let's assume you put them on $HOME/bin
.
Ensure they are executable by running chmod +x $HOME/bin/npm $HOME/bin/prisma
Use node:latest
or a derivative image to run the code from each chapter.
Use docker-compose up -d
to start up app components, and docker-compose restart
to reload app
components after a change. Map ports 4000:4000
in order to access the playground app on localhost:4000
as instructed during the demo.
Mount your working directory to /usr/app
, and ensure /usr/app
is your working directory.