Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor config #182

Merged
merged 7 commits into from
May 9, 2018
Merged

Refactor config #182

merged 7 commits into from
May 9, 2018

Conversation

olafveerman
Copy link
Contributor

@olafveerman olafveerman commented May 8, 2018

Refactor config so it's easier to deploy the frontend with CF. Fix #181 and #183

This makes significant changes to the Docker image. The built site will not be pre-baked in the image, instead it is to be built when the container starts. This allows environment variables to be passed like below.

@danielfdsilva This works well, but is slow. Launching the container takes a couple of minutes.

Also, when you build the image, make sure you have do it from a clean project without node_modules or dist.

version: '3'

services:
  ram-frontend:
    image: ram-frontend-test
    command: sh .build_scripts/serve.sh
    environment:
      API: 'https://happy.api.io'
    ports:
      - 8080:80

Instead of baking the pre-built site in the Docker image, the site has to be built when spinning up a Docker container
@olafveerman olafveerman force-pushed the feature/181-new-config-setup branch from c359a18 to 2ab5416 Compare May 8, 2018 20:43
@olafveerman
Copy link
Contributor Author

When this receives your thumbsup, I need to change this in the docker-compose config on the backend as well.

@danielfdsilva
Copy link
Collaborator

danielfdsilva commented May 9, 2018

@olafveerman Couple of improvements:

  • Add node_modules and dist to .dockerignore so there's no need to delete the folders when building.
  • Instead of having the command in the docker-compose.yml this could be the default command for the image making it easier to run even in standalone format. You'd use docker run ram-frontend instead of docker run -it ram-frontend sh /source/.build_scripts/serve.sh. For this simply add CMD ["sh", "/source/.build_scripts/serve.sh"] to `Dockerfile
  • Update readme with instructions on building and running the docker.
  • Add a message at the end of serve.sh stating that the app is now being served. I was left waiting for nginx to print out something

Overall it works great! 👍

- set default CMD to make it easier to run the container
- add docs to Readme
- ignore node_modules and dist
- print message so user knows when serve.sh is done
@olafveerman olafveerman force-pushed the feature/181-new-config-setup branch from 895a05f to cdd2360 Compare May 9, 2018 12:24
@olafveerman olafveerman merged commit 93814b9 into develop May 9, 2018
@danielfdsilva danielfdsilva deleted the feature/181-new-config-setup branch May 11, 2018 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants