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

Docker for development and production environments #261

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

ltfschoen
Copy link
Contributor

@ltfschoen ltfschoen commented Dec 15, 2022

  • Runs Docker container in development environment on port 8000. Final images: stage 1 node (118MB); stage 2 dev (510MB)
  • Runs Docker container in production environment on port 8001 with Nginx. Final image stage 0 nginx (23.5MB); stage 1 node (118MB); stage 2 prod (~562MB)
  • Readme includes useful Docker and Nginx commands
  • Allows developers to connect the code editor on their host machine to Docker container that may also be running on that same host machine or on a remote server. If on their host machine they could preview the changes at localhost:8000 and localhost:8001, but for production it is necessary to access via the Public IP Address of the remote server <PUBLIC_IP>:8000 or <PUBLIC_IP>:8001. Hot reloading to preview live changes immediately isn't working properly (in VSCode still have to save twice for changes to take effect, or save code changes and reload the webpage), hence the use of WATCHPACK_POLLING=true in the package.json file, which is required since we're using dependency react-scripts 5.
  • Includes copyright header in files that were inspired by files from Polkadot.js Apps where some code by @jacogr was borrowed and modified
  • Excludes the env.sh approach used by Polkadot.js Apps here https://github.com/polkadot-js/apps/blob/master/env.sh since we are already using the template config object approach mentioned in the readme of this repo, however I can make a separate PR to include this functionality where it reads the contents of the .env file, then in an env.sh file the user may whitelist variables from the .env file that they want to add to an env-config.js file that may be injected as a script in the index.html file, however I was only able to get it to generate the env-config.js file in production, but I wasn't able to get it to work in development when running yarn run start, so I excluded it but I don't believe it is necessary anyway
  • This PR might help close Start the front-end template : error:0308010C:digital envelope routines::unsupported #245 by @565ee, and yarn start not working  #259 by
    @hariaccubits
  • needs to be tweaked when PR for typescript is merged similar to this https://medium.com/@kartikio/setup-node-ts-local-development-environment-with-docker-and-hot-reloading-922db9016119

@ltfschoen ltfschoen changed the title Docker xmas present Docker for dev and prod env Dec 15, 2022
@ltfschoen ltfschoen changed the title Docker for dev and prod env Docker for development and production environments Dec 15, 2022
docker-compose-dev.yml Outdated Show resolved Hide resolved
docker-dev.sh Outdated Show resolved Hide resolved
docker/build.sh Outdated Show resolved Hide resolved
docker-dev.sh Outdated Show resolved Hide resolved
docker/build.sh Outdated Show resolved Hide resolved
&& yarn set version 3.1.1 \
&& yarn plugin import interactive-tools \
&& echo -e "nodeLinker: node-modules\n\n$(cat ${APP_PATH}/.yarnrc.yml)" > ${APP_PATH}/.yarnrc.yml \
&& yarn
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be yarn install --production

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.

Start the front-end template : error:0308010C:digital envelope routines::unsupported
1 participant