Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
4fd4c0d
"Added Dockerfile and push Image to DockerHub"
RohanRusta21 May 26, 2023
4277d42
Updated dockerimagepush.yml
RohanRusta21 May 30, 2023
42376b7
Updated dockerimagepush.yml
RohanRusta21 May 30, 2023
11c2e6a
Updated dockerimagepush.yml
RohanRusta21 May 30, 2023
1670ae0
Updated dockerimagepush.yml
RohanRusta21 May 30, 2023
f210977
Updated Dockerfile
RohanRusta21 May 30, 2023
a6e95b2
Updated Dockerfile
RohanRusta21 May 30, 2023
935b043
Updated dockerimagepush.yml with Trivy
RohanRusta21 May 30, 2023
dc160d9
Updated dockerimagepush.yml
RohanRusta21 May 30, 2023
9053d35
Update dockerimagepush.yml
RohanRusta21 May 30, 2023
4870de6
Updated dockerimagepush.yml
RohanRusta21 May 30, 2023
bc7415f
Updated Dockerfile
RohanRusta21 May 30, 2023
44b0c7d
Update README.md
RohanRusta21 May 30, 2023
f4f0e3f
Update Dockerfile
RohanRusta21 May 30, 2023
f2896ef
Update dockerimagepush.yml
RohanRusta21 May 30, 2023
54e9526
Update README.md
RohanRusta21 May 30, 2023
84b3f63
Updated dockerimagepush.yml with Build Number Versioning
RohanRusta21 May 30, 2023
6120897
Updated dockerimagepush.yml
RohanRusta21 May 30, 2023
ab1f0c5
Updated README.md
RohanRusta21 May 31, 2023
10db68b
Create deployment.yml
RohanRusta21 Jun 21, 2023
5f543d6
Create service.yml
RohanRusta21 Jun 21, 2023
eb8b779
Update deployment.yml
RohanRusta21 Jun 21, 2023
2672d9e
Update service.yml
RohanRusta21 Jun 21, 2023
c786447
Create deployment.yml
RohanRusta21 Jun 21, 2023
8c97b20
Create service.yml
RohanRusta21 Jun 21, 2023
0f5f4ed
Delete manifest directory
RohanRusta21 Jun 21, 2023
3deea35
Update dockerimagepush.yml
RohanRusta21 Aug 25, 2023
8175af1
Update service.yml
RohanRusta21 Apr 21, 2024
baafa80
Update service.yml back to lb
RohanRusta21 Apr 21, 2024
cf2161d
Update README.md
RohanRusta21 Feb 1, 2025
03ee3c4
Update README.md
RohanRusta21 Feb 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/workflows/dockerimagepush.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Build and Push Docker Image to DockerHub

on:
schedule:
- cron: '0 0 * * *'
push:
branches:
- main

env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USER }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
REPO_NAME: "weather-app"

jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Install Trivy
run: |
wget https://github.com/aquasecurity/trivy/releases/download/v0.18.3/trivy_0.18.3_Linux-64bit.deb
sudo dpkg -i trivy_0.18.3_Linux-64bit.deb
- name: Build Docker Image
run: docker build -t "${DOCKERHUB_USERNAME}/${REPO_NAME}:$GITHUB_RUN_NUMBER" .
- name: Scan container images
run: |
trivy image "${DOCKERHUB_USERNAME}/${REPO_NAME}:$GITHUB_RUN_NUMBER"
- name: Login to DockerHub
run: echo "${DOCKERHUB_TOKEN}" | docker login -u "${DOCKERHUB_USERNAME}" --password-stdin
- name: Push Docker Image to DockerHub
run: docker push "${DOCKERHUB_USERNAME}/${REPO_NAME}:$GITHUB_RUN_NUMBER"


update-manifest-stage:
runs-on: ubuntu-latest
needs: ['build-and-push']
steps:
- uses: actions/checkout@v3
with:
repository: RohanRusta21/weather-app-manifests
ref: 'main'
token: ${{ secrets.G_TOKEN }}
- name: setup git config
run: |
git config --global user.email "[email protected]"
git config --global user.name "RohanRusta21"
echo ${{ github.sha }}
sed -i "s#${DOCKERHUB_USERNAME}.*#${DOCKERHUB_USERNAME}/${REPO_NAME}:$GITHUB_RUN_NUMBER#g" deployment.yml
git add -A
git commit -am "Update image for Version - $GITHUB_RUN_NUMBER"
- run: echo ${{ github }}
- run: git push origin main
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Stage 1: Build the application
FROM node:16
LABEL maintainer="Rohan Rustagi"
WORKDIR /app
COPY package-lock.json ./
COPY package.json ./
RUN npm install
COPY . .
EXPOSE 3000
CMD [ "npm", "start" ]
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Getting Started with Create React App

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app)

## Available Scripts

Expand Down Expand Up @@ -31,7 +31,7 @@ See the section about [deployment](https://facebook.github.io/create-react-app/d

### `npm run eject`

**Note: this is a one-way operation. Once you `eject`, you can't go back!**
**Note: this is a one-way operation. Once you `eject`, you can't go back**

If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Expand Down Expand Up @@ -65,6 +65,9 @@ This section has moved here: [https://facebook.github.io/create-react-app/docs/a

This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)

### `npm run build` fails to minify
### `npm run build` fails to minify.

This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)


### Testing workflow....
21 changes: 21 additions & 0 deletions deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: weather-app
spec:
replicas: 2
selector:
matchLabels:
app: weather-app
template:
metadata:
labels:
app: weather-app
spec:
containers:
- name: weather-app
image: wededo4644/react_weather_app:latest
imagePullPolicy: Always
ports:
- containerPort: 3000

Loading