phlask / phlask-map

Code behind the Phlask Web Map
https://beta.phlask.me
34 stars 34 forks source link

Update Running Phlask App Locally with Docker #240

Closed tnguyen21 closed 2 years ago

tnguyen21 commented 2 years ago

Is your feature request related to a problem? Please describe. README has guidance and recommendation for running the Phlask app locally with Docker, however, that documentation is outdated. Last time I've tried (maybe a year ago, now) the README steps didn't work. For the time being the guidance for new contributors has been to use yarn start or npm start to run the app and develop locally, but as the README and @gcardonag notes, developing within containers lets us have a consistent dev environment across operating systems and machines.

Describe the solution you'd like Updating README with instructions on how to install Docker, update Dockerfile to address any bugs with getting the Phlask app running locally.

Also include brief explanation of what Docker is, and outbound links to Docker documentation so contributors can learn more (if they want).

Describe alternatives you've considered Could create a /.devcontainer at the root of the repo which takes advantage VS Code's support for building and running containers. However, this might be inconvenient for developers who aren't developing in VS Code, and may end up being more work since whoever sets this up will also need to set up a devcontainer.json

tnguyen21 commented 2 years ago

Re-installed Docker Desktop for my Windows 10 machine and managed to get the app running with the instructions in the README. However, there were several parts during the setup where it hanged. Not sure if it's something with my local machine, or something we should document as a known issue. Need someone else to confirm that the initial docker-compose build app is slow, and initially starting up the server hangs a bit too.

tnguyen21 commented 2 years ago
      $ docker-compose build app

      [+] Building 238.2s (12/12) FINISHED
      => [internal] load build definition from Dockerfile 0.0s
      => => transferring dockerfile: 32B 0.0s
      => [internal] load .dockerignore 0.0s
      => => transferring context: 34B 0.0s
      => [internal] load metadata for docker.io/library/node:12-slim 11.7s
      => [auth] library/node:pull token for registry-1.docker.io 0.0s
      => [internal] load build context 0.1s
      => => transferring context: 14.38kB 0.0s
      => [1/6] FROM docker.io/library/node:12-slim@sha256:f2cb1dd1723001fa51ae27e07cc91f8eba5a081922a2a59611da28676 0.0s
      => CACHED [2/6] WORKDIR /usr/src/app 0.0s
      => CACHED [3/6] COPY package\*.json ./ 0.0s
      => CACHED [4/6] RUN apt-get update && apt-get install -y libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libg 0.0s
      => [5/6] RUN yarn install 200.4s
      => [6/6] COPY . . 7.2s
      => exporting to image 18.5s
      => => exporting layers 18.4s
      => => writing image sha256:c98cfb58fd386def6bde83064f7b15a1c7c8ca3b32a8206bfe47a6e4f68f79b2 0.0s
      => => naming to docker.io/library/phlask-map_app 0.0s

Example output from successful build and run.