Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dockerized Python & React/Vite Demo

This repository contains two main examples:

  1. BasicApp
    A simple Python (Flask) application containerized with Docker.

  2. ComposeApp
    A full stack using Docker Compose with:

    • A Python (Flask) backend (back).
    • A React/Vite frontend (front).

Folder Structure

.
├── BasicApp
│   ├── app.py
│   ├── requirements.txt
│   └── Dockerfile (example: single-container Python app)
├── ComposeApp
│   ├── back
│   │   ├── app.py
│   │   ├── requirements.txt
│   │   └── Dockerfile (backend Dockerfile)
│   ├── front
│   │   ├── src
│   │   │   ├── App.css
│   │   │   ├── App.tsx
│   │   │   └── ...
│   │   ├── public
│   │   ├── package.json
│   │   └── Dockerfile (frontend Dockerfile)
│   └── docker-compose.yml
└── Solutions (additional solutions or examples)

Running the BasicApp

  1. Navigate to the BasicApp directory.

  2. Build the Docker image:

    docker build -t basic-app .
  3. Run the container:

    docker run -p 5000:5000 basic-app
  4. Access the app at http://localhost:5000/hello-world.

Running the ComposeApp

  1. Navigate to the ComposeApp directory.

  2. Build and run the containers using Docker Compose:

    docker compose up -d --build

    This command will build images (if needed) and run the services in detached mode.

  3. If you only changed a single service and want to rebuild just that service without touching the others, you can run:

    docker compose up -d --no-deps --build <service-name>

    For example:

    docker compose up -d --no-deps --build back

Default Ports

  • The backend listens on port 5000 (e.g., http://localhost:5000/hello-world).
  • The frontend listens on port 3000 or 80 (depending on your Dockerfile/Compose configuration).

Useful Commands

  • To view logs:

    docker compose logs -f
  • To stop the services:

    docker compose down

Modifications

  • BasicApp: Update app.py or requirements.txt as needed, then rebuild the image.
  • ComposeApp: Adjust Dockerfile settings for both the backend and frontend, as well as docker-compose.yml, to customize your stack. Rebuild only the changed service with --no-deps --build if you want faster rebuilds.

License

This project is distributed under the MIT License. See LICENSE for details.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages