Skip to content

Commit

Permalink
Merge pull request 40-oper/setup-prod
Browse files Browse the repository at this point in the history
40 oper/setup prod
  • Loading branch information
b4hia authored Nov 12, 2024
2 parents ced9abb + 5b0748b commit 7d23d74
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 22 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/ec2deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
env:
AWS_PRIVATE_KEY: ${{ secrets.KEYAWS }}
EC2_IP: ${{ secrets.EC2_IP }}
BACKEND_PORT: ${{ secrets.BACKEND_PORT }}
SSH_OPTIONS: '-o StrictHostKeyChecking=no -i key.pem ubuntu@${{ secrets.EC2_IP }}'

jobs:
Expand Down Expand Up @@ -51,6 +52,10 @@ jobs:
run: |
scp -o StrictHostKeyChecking=no -i key.pem -r ./tupan/ ubuntu@${{ env.EC2_IP }}:/home/ubuntu/tupan
- name: Create .env file
run: |
echo "BACKEND_URL=${{ env.EC2_IP }}:${{ env.BACKEND_PORT }}/" >> tupan/.env
- name: SSH into AWS and build Docker image
run: |
ssh ${{ env.SSH_OPTIONS }} 'cd /home/ubuntu/tupan/tupan && sudo docker build -t tupan-front .'
Expand Down
20 changes: 0 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions tupan/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
# misc
.DS_Store
*.pem
.env

# debug
npm-debug.log*
Expand Down
2 changes: 1 addition & 1 deletion tupan/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ FROM base AS deps
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY package.json package-lock.json* ./
RUN npm ci
RUN npm ci --legacy-peer-deps

FROM base AS builder
WORKDIR /app
Expand Down
13 changes: 13 additions & 0 deletions tupan/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions tupan/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"@material-tailwind/react": "^2.1.10",
"@types/js-cookie": "^3.0.6",
"axios": "^1.7.7",
"dotenv": "^16.4.5",
"flowbite": "^2.5.1",
"highcharts": "^11.4.8",
"js-cookie": "^3.0.5",
Expand Down
5 changes: 4 additions & 1 deletion tupan/src/app/_api/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
export const api_route: string = 'http://localhost:8000/';
import * as dotenv from 'dotenv';
dotenv.config();

export const api_route: string = process.env.BACKEND_URL || 'http://localhost:8000/';

0 comments on commit 7d23d74

Please sign in to comment.