ziyi01 / Inkposter

Project for course DH2643 at KTH.
Apache License 2.0
1 stars 0 forks source link

Docker, Deployment and CICD #21

Closed ziyi01 closed 1 week ago

ziyi01 commented 1 week ago

A Dockerfile has been created to set up the project, package.json has also been adjusted to fit that. The docker image can be pulled from https://hub.docker.com/r/ziyi01/inkposter:

$ docker pull ziyi01/inkposter

docker-compose.yml has been added to run the container during development, it is run by (in the root):

$ docker-compose build
$ docker-compose up

Add a --detach flag if you want it to run in the background and docker-compose down -v closes the container process. It should all be accessible from localhost:3000 and the REST-API from localhost:3000/users.

Three workflows: node.js.yml, docker.yml, main.yml have been added. node.js.yml uses Jest to run unit tests (if available) during pushes and pull requests to the main-branch. docker.yml runs when a Docker-file has been changed on main and pushes the image at docker hub. main.yml builds and deploys the application to Heroku.

Most importantly the static build files from the App should be mounted in server/app.js

closes #3, closes #2 (still need to add tests) also closes #18 if we do it like this.

ziyi01 commented 1 week ago

I forgot to comment! The changes mean that we develop server and client separately but they are deployed in the same application but with routes to the REST API. This removes the viewengine from the server for now and adds the static files of the React app.

Everything should be able to be started from root by using npm run dev-build och npm start (or by using docker-compose).