-
Notifications
You must be signed in to change notification settings - Fork 0
Setting up studentsaver in Docker
- Docker environment (https://docs.docker.com/install/)
- Mysql database that runs in a container (https://hub.docker.com/_/mysql)
- Network connection between the two containers (the API needs a connection to a database for it to work)
studentsaver is made out of three components: The backend, The front-end and The database. We recommend to containerize everything so you will need to run three containers in total, one container for each component. As listed in the prerequisite we assume you already have a working mysql container. lets start with the backend container.
In the backend folder listed on this github page you will need to configure the dockerfile to meet your specifications. In the dockerfile the "env" are variables that needs to match with your mysql server so
After configuring the dockerfile you can start building it. To start building the docker image you will need to run the following command on you machine where docker engine runs on:
-t elis
is a tag that gives a name to the image that you are building
importent note: You will need to run the docker build command inside the backend folder where the dockerfile is residing.
After building the image you need to run the image as a container. We use port 3000:3000 for all our api traffic but you can change that ofcourse
After you run this command the api should be active from the containers ip: localhost:3000
When the api is running you can move on to the front end component. The dockerfile of the front end consists of multiple stages. stage 0 is for running nodejs and stage 1 is for serving the webcontent. You will need to build the image with the following command: docker build -t vladimir .
importent note: You will need to run the docker build command inside the front end folder where the dockerfile is residing.
After building the image you can run the image with the following command: docker run -p 3001:80 vladimir
your front end should now be accesible from localhost:80