-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
de91a6a
commit f4f22e0
Showing
10 changed files
with
231 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: Deploy to AWS App Runner | ||
|
||
# Trigger this workflow on any push to the 'main' branch | ||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
# Job for deploying the backend service | ||
deploy-backend: | ||
name: Deploy Backend to AWS App Runner | ||
runs-on: ubuntu-latest # Run on the latest version of Ubuntu | ||
|
||
steps: | ||
# Step 1: Checkout the code from the repository | ||
- name: Checkout code | ||
uses: actions/checkout@v3 # GitHub Action to checkout the code | ||
|
||
# Step 2: Set up AWS CLI with necessary credentials | ||
- name: Set up AWS CLI | ||
uses: aws-actions/configure-aws-credentials@v2 # GitHub Action to configure AWS credentials | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} # AWS Access Key ID stored as a GitHub secret | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} # AWS Secret Access Key stored as a GitHub secret | ||
aws-region: us-east-1 # AWS Region stored as a GitHub secret | ||
|
||
# Step 3: Deploy the backend service to AWS App Runner | ||
- name: Deploy Backend | ||
run: | | ||
# AWS CLI command to update the backend service in AWS App Runner | ||
aws apprunner update-service \ | ||
--service-arn $(aws apprunner list-services --query "ServiceSummaryList[?ServiceName=='${{ secrets.APP_RUNNER_SERVICE_NAME_BACKEND }}'].ServiceArn | [0]" --output text) \ | ||
--source-configuration SourceCodeRepository={"RepositoryUrl": "${{ secrets.REPOSITORY_URL_BACKEND }}", "SourceCodeVersion": {"Type": "BRANCH", "Value": "master"}} | ||
# Job for deploying the frontend service | ||
deploy-frontend: | ||
name: Deploy Frontend to AWS App Runner | ||
runs-on: ubuntu-latest # Run on the latest version of Ubuntu | ||
|
||
steps: | ||
# Step 1: Checkout the code from the repository | ||
- name: Checkout code | ||
uses: actions/checkout@v3 # GitHub Action to checkout the code | ||
|
||
# Step 2: Set up AWS CLI with necessary credentials | ||
- name: Set up AWS CLI | ||
uses: aws-actions/configure-aws-credentials@v2 # GitHub Action to configure AWS credentials | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} # AWS Access Key ID stored as a GitHub secret | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} # AWS Secret Access Key stored as a GitHub secret | ||
aws-region: ${{ secrets.AWS_REGION }} # AWS Region stored as a GitHub secret | ||
|
||
# Step 3: Deploy the frontend service to AWS App Runner | ||
- name: Deploy Frontend | ||
run: | | ||
# AWS CLI command to update the frontend service in AWS App Runner | ||
aws apprunner update-service \ | ||
--service-arn $(aws apprunner list-services --query "ServiceSummaryList[?ServiceName=='${{ secrets.APP_RUNNER_SERVICE_NAME_FRONTEND }}'].ServiceArn | [0]" --output text) \ | ||
--source-configuration SourceCodeRepository={"RepositoryUrl": "${{ secrets.REPOSITORY_URL_FRONTEND }}", "SourceCodeVersion": {"Type": "BRANCH", "Value": "master"}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
|
||
|
||
services: | ||
frontend: | ||
build: | ||
context: ./frontend | ||
dockerfile: Dockerfile | ||
ports: | ||
- "80:80" | ||
depends_on: | ||
- backend | ||
|
||
backend: | ||
build: | ||
context: ./linguaphoto | ||
dockerfile: Dockerfile | ||
ports: | ||
- "8000:8000" | ||
environment: | ||
DEBUG: "true" | ||
AWS_REGION: " us-east-1" # Environment variables for DynamoDB | ||
AWS_ACCESS_KEY_ID: "your-access-key-id" | ||
AWS_SECRET_ACCESS_KEY: "your-secret-access-key" | ||
DYNAMODB_ENDPOINT: "http://dynamodb:8002" # Local DynamoDB endpoint | ||
REDIS_URL: "redis://redis:6379" # Redis connection URL | ||
|
||
dynamodb: | ||
image: amazon/dynamodb-local | ||
ports: | ||
- "8002:8000" | ||
|
||
dynamodb-admin: | ||
image: aaronshaf/dynamodb-admin | ||
ports: | ||
- "8001:8001" | ||
environment: | ||
- DYNAMO_ENDPOINT=http://dynamodb:8000 | ||
|
||
redis: | ||
image: redis | ||
ports: | ||
- "6379:6379" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
# .dockerignore | ||
|
||
# Only add the build directory to Docker. | ||
* | ||
!build/ | ||
node_modules | ||
build | ||
dist | ||
.git | ||
Dockerfile | ||
README.md | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Use an official Node.js runtime as a parent image | ||
FROM node:20.10.0-alpine AS build | ||
|
||
# Set the working directory in the container | ||
WORKDIR /src | ||
|
||
# Copy package.json and package-lock.json | ||
COPY package*.json ./ | ||
|
||
# Install dependencies | ||
RUN npm install | ||
|
||
# Copy the rest of the application code | ||
COPY . . | ||
|
||
# Build the React app | ||
RUN npm run build | ||
|
||
# Use a lightweight web server to serve the React app | ||
FROM nginx:1.25-alpine | ||
|
||
# Copy the build output to Nginx's html directory | ||
COPY --from=build /src/build /usr/share/nginx/html | ||
|
||
# Expose port 80 to the outside world | ||
EXPOSE 80 | ||
|
||
# Start Nginx when the container launches | ||
CMD ["nginx", "-g", "daemon off;"] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.