Skip to content

Commit

Permalink
introduced docker
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffbonson committed May 23, 2024
1 parent f741679 commit d71fd0c
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 1 deletion.
23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Use a specific version of Node.js
FROM node:16.13.1-alpine

# Set the working directory in the container
WORKDIR /app

# Copy package.json and package-lock.json to the working directory
COPY package*.json ./

# Install dependencies
RUN npm install

# Copy the rest of the application code
COPY . .

# Build the React app
RUN npm run build

# Expose port 3000 to the outside world
EXPOSE 3000

# Define the command to run your app
CMD ["npm", "start"]
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
Just an app to test react - docker - aws -cicd
Just an app to test react - docker - aws -cicd.
# From Windows Create a React app named - react-docker-aws-cicd
- Push to git hub repository - https://github.com/jeffbonson/react-docker-aws-cicd
# Create a Dockerfile in the root directory
- Build the docker image using the docker file - docker build -t jeffbonson85/react-docker-aws-cicd:latest .
- Check for jeffbonson85/react-docker-aws-cicd in the docker hub's Images page.
- Stop the react server
- Open Docker Desktop
- Run the image using the command - docker run -d -p 3000:3000 jeffbonson85/react-docker-aws-cicd:latest
- Run the command to see running containers - docker ps
- Check for an entry in containers
- open localhost:3000 in web browser
# Push to docker hub - hub.docker.com
- Tag the docker image using the command - docker tag jeffbonson85/react-docker-aws-cicd:latest jeffbonson85/react-docker-aws-cicd:latest
- Push to docker hub using the command - docker push jeffbonson85/react-docker-aws-cicd:latest
- Login to hub.docker.com and refresh the Repositories page to see the new repository named - jeffbonson85/react-docker-aws-cicd:latest.
# To use this in MacBook
- Install Docker Desktop / colima in mac OS
- docker login
- Go to hub.docker.com/repositories/react-docker-aws-cicd/tags and copy the command - docker pull jeffbonson85/react-docker-aws-cicd:latest
- run the command - docker run -d -p 3000:3000 jeffbonson85/react-app:latest
- open localhost:3000 in web browser
- yay!


# Getting Started with Create React App

Expand Down

0 comments on commit d71fd0c

Please sign in to comment.