This project is a simple React application created for testing and experimenting with Docker. The main goal is to understand how Docker works, dockerize a React app, and implement CI/CD processes using a Docker image repository.
This project is a simple React application designed for learning and experimenting with Docker. It focuses on:
- Dockerizing a React application
- Using Docker image repositories
- Implementing CI/CD processes with Docker
To run this project locally, you need to have the following installed:
-
Clone the repository:
git clone https://github.com/BaselessFabric/docker-react.git cd docker-react
-
Install NPM packages:
npm install
To run the application locally, use the following command:
npm start
This will start the development server and open the application in your default web browser.
To build a Docker image of the React application, use the following command:
docker build -t docker-react .
To run the Docker container, use the following command:
docker run -p 3000:3000 docker-react
This will start the application in a Docker container and make it accessible at http://localhost:3000
.
For the CI/CD pipeline, you can use a service like GitHub Actions, GitLab CI, or Jenkins. This project includes a basic GitHub Actions workflow file.
- The workflow will trigger on push and pull request events.
- It will build the Docker image.
- It will run tests (if any).
- It will push the Docker image to a Docker image repository (Docker Hub, AWS ECR, etc.).
Example GitHub Actions workflow file (.github/workflows/docker.yml
):
name: Docker CI/CD
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: your-username/docker-react:latest
Contributions are welcome! Please fork this repository and create a pull request with your changes. For major changes, please open an issue first to discuss what you would like to change.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE
for more information.
Alex Walls
Project Link: https://github.com/BaselessFabric/docker-react.git