Skip to content

Commit

Permalink
add: test aws ec2
Browse files Browse the repository at this point in the history
  • Loading branch information
sagunkhatri committed Jun 26, 2024
1 parent 00d063f commit 7b0e826
Show file tree
Hide file tree
Showing 41 changed files with 34,252 additions and 0 deletions.
87 changes: 87 additions & 0 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Transfer Build Files

on:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v2

- name: Setup SSH
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
known_hosts: ${{ secrets.KNOWN_HOSTS }}

- name: executing remote ssh commands using passwordss
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.REMOTE_HOST }}
username: ${{ secrets.REMOTE_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
whoami
# cd /home/ubuntu/devops-class
# git pull origin main
# cd all_in_docker
# sudo docker-compose build
# sudo docker-compose up -d backend
# sudo docker-compose up -d frontend
# - name: Transfer Build Files to Ubuntu Instance
# uses: appleboy/scp-action@master
# with:
# host: ${{ secrets.REMOTE_HOST }}
# username: ${{ secrets.REMOTE_USERNAME }}
# key: ${{ secrets.SSH_PRIVATE_KEY }}
# source: "build"
# target: "/tmp"

# - name: Check ls j
# run: ls

# - name: Check file existence
# id: check_files
# uses: andstor/file-existence-action@v1
# with:
# files: "build"
# allow_failure: true

# - name: Archive Build Files
# uses: actions/upload-artifact@v2
# with:
# name: build
# path: ./build

# transfer-files:
# runs-on: ubuntu-latest
# needs: build
# defaults:
# run:
# working-directory: ./all_in_docker/client
# steps:
# - name: Checkout Repository
# uses: actions/checkout@v2

# - name: Download Build Files
# uses: actions/download-artifact@v2
# with:
# name: build
# path: ./

# - name: Transfer Build Files to Ubuntu Instance
# uses: appleboy/scp-action@master
# with:
# host: ${{ secrets.REMOTE_HOST }}
# username: ${{ secrets.REMOTE_USERNAME }}
# key: ${{ secrets.SSH_PRIVATE_KEY }}
# source: "build/*"
# target: "/path/on/remote/server/"


1 change: 1 addition & 0 deletions all_in_docker/client/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
1 change: 1 addition & 0 deletions all_in_docker/client/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
REACT_APP_API_URL = http://35.170.248.42:3001
24 changes: 24 additions & 0 deletions all_in_docker/client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
.github/*
10 changes: 10 additions & 0 deletions all_in_docker/client/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM node:14-alpine as builder
WORKDIR /app
COPY . .
RUN npm install
RUN npm run-script build

FROM nginx:stable-alpine3.17-slim
COPY --from=builder /app/build /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
Loading

0 comments on commit 7b0e826

Please sign in to comment.