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

Containerization of a React app #70

Open
2 tasks
rpmolina opened this issue Apr 25, 2023 · 4 comments
Open
2 tasks

Containerization of a React app #70

rpmolina opened this issue Apr 25, 2023 · 4 comments

Comments

@rpmolina
Copy link
Contributor

rpmolina commented Apr 25, 2023

Describe the feature

We can use Docker Compose to Dockerize a frontend app along with any necessary services, such as a database or backend API. To Dockerize a frontend app using Docker Compose, we can follow these general steps:

It's important to ensure that your docker-compose.yml file is optimized for size and security to ensure that your containerized app runs smoothly and securely.

Use Case

Reference

Proposed Solution

Create the example at examples/compose-react. You can use https://www.npmjs.com/package/create-awesome-node-app to check existing implementations for this issue.

After that add it as an example at examples/compose-react

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

Version used

Environment details (OS name and version, etc.)

┆Issue is synchronized with this Clickup task by Unito

@ulises-jeremias ulises-jeremias changed the title Containerization of a frontend app. Containerization of a React app May 3, 2023
@ulises-jeremias ulises-jeremias transferred this issue from nanlabs/nancy.js May 3, 2023
@Siddharth9890
Copy link

@ulises-jeremias can i try this

@ulises-jeremias
Copy link
Member

@Siddharth9890 sure!

@Siddharth9890
Copy link

hey @ulises-jeremias i have a doubt i have made a docker compose file just for testing is this fine?


version: '3'


volumes:
  postgres-data:
    name: my-app-postgres-data
  
services:
  frontend:
    build:
      context: ./frontend  
    environment:
      - REACT_APP_PORT=3000  
    ports:
      - ${REACT_APP_PORT}:3000 
   

  backend:
    build:
      context: ./backend  
    environment:
      - NODE_API_PORT=8080
    ports:
      - ${NODE_API_PORT}:8000 
    depends_on:
      - database  

  database:
    image: postgres:13  # Use a specific version of PostgreSQL
    environment:
      POSTGRES_USER: user_name
      POSTGRES_PASSWORD: password
      POSTGRES_DB: db_name
    volumes:
      - postgres-data:/var/lib/postgresql/data 

@ulises-jeremias
Copy link
Member

@Siddharth9890 hey! you can use the following command to generate a small project and use it as reference 😊 not need to include the database and backend on this PR 👌🏻

https://www.npmjs.com/package/create-awesome-node-app

it will guide you to create a Frontend Application with our React Vite boilerplate and with docker

you can create a PR using that as referece 👌🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🏗 In progress
Development

No branches or pull requests

4 participants