Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
MazeWorksSuriya committed Aug 22, 2024
1 parent 720d6a5 commit 988b27f
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 1 deletion.
27 changes: 27 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Deploy Frontend
on:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
- run: docker build -t ksspam/react-test -f Dockerfile.dev .
- run: docker run -e CI=true ksspam/react-test npm test

- name: Generate deployment package
run: zip -r deploy.zip . -x '*.git*'

- name: Deploy to EB
uses: einaregilsson/beanstalk-deploy@v18
with:
application_name: docker
environment_name: Docker-env
existing_bucket_name: elasticbeanstalk-ap-south-1-443370700977
region: ap-south-1
version_label: ${{ github.sha }}
deployment_package: deploy.zip
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM node:lts-alpine3.18 as build_stage

WORKDIR /app

COPY package.json .

RUN ["npm", "install"]

COPY . .

RUN ["npm", "run", "build"]


FROM nginx:alpine3.19

COPY --from=build_stage /app/build /usr/share/nginx/html
11 changes: 11 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM node:lts-alpine3.18

WORKDIR /app

COPY package.json .

RUN npm install

COPY . .

CMD ["npm", "run", "start"]
21 changes: 21 additions & 0 deletions docker-compose-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: "3.0"

services:
react-app:
build:
context: .
dockerfile: Dockerfile.dev
ports:
- "3001:3000"
volumes:
- /app/node_modules
- .:/app/

react-app-test:
build:
context: .
dockerfile: Dockerfile.dev
volumes:
- /app/node_modules
- .:/app/
command: ["npm", "run", "test"]
8 changes: 8 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: '3'
services:
web:
build:
context: .
dockerfile: Dockerfile
ports:
- '80:80'
2 changes: 1 addition & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function App() {
target="_blank"
rel="noopener noreferrer"
>
Learn React
Learn React and Docker Too
</a>
</header>
</div>
Expand Down

0 comments on commit 988b27f

Please sign in to comment.