Skip to content
This repository was archived by the owner on Feb 6, 2025. It is now read-only.

Docker for development and production environments - #261

Open
ltfschoen wants to merge 15 commits into
jimmychu0807:mainfrom
ltfschoen:luke/docker-minimal
Open

Docker for development and production environments#261
ltfschoen wants to merge 15 commits into
jimmychu0807:mainfrom
ltfschoen:luke/docker-minimal

Conversation

@ltfschoen

@ltfschoen ltfschoen commented Dec 15, 2022

Copy link
Copy Markdown
Contributor
  • 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
Comment thread docker-compose-dev.yml Outdated
Comment thread docker-dev.sh Outdated
Comment thread docker/build.sh Outdated
Comment thread docker-dev.sh Outdated
Comment thread docker/build.sh Outdated
Comment thread docker/Dockerfile.prod
&& 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
Copy Markdown
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 subscribe to this conversation on GitHub. Already have an account? Sign in.

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