Skip to content
This repository has been archived by the owner on Apr 24, 2020. It is now read-only.

Setting up studentsaver in Docker

Noam edited this page Feb 27, 2020 · 20 revisions

Table of Contents

  1. Prerequisite
  2. Installation

Prerequisite

Installation

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.

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

port of your mysql server: env DB_PORT=
ip or hostname of your mysql server: env DB_HOST=
password of you mysql server: env DB_PASSWORD=
username of you mysql server: env DB_USER=
database name of you mysql server: env DB_NAME=

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:

docker build -t ellis .

-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

docker run -d -p 3000:3000 ellis

After you run this command the api should be active from the containers ip: localhost:3000

Front end container

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