-
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.
Modified compose.yml and added github workflows
- Loading branch information
Showing
2 changed files
with
74 additions
and
18 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,55 @@ | ||
# yaml-language-server: $schema='none' | ||
|
||
name: Deploy to AWS Elastic Beanstalk | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build-and-push: | ||
runs-on: ubuntu-latest | ||
env: | ||
DOCKER_REGISTRY: docker.io | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
# # Not very useful for now, but can help in caching | ||
# - name: Set up Docker Buildx | ||
# uses: docker/setup-buildx-action@v4 | ||
|
||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Build and push frontend image | ||
run: | | ||
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/langjam-frontend ./frontend | ||
docker push ${{ secrets.DOCKERHUB_USERNAME }}/langjam-frontend | ||
- name: Build and push backend image | ||
run: | | ||
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/langjam-backend ./backend | ||
docker push ${{ secrets.DOCKERHUB_USERNAME }}/langjam-backend | ||
deploy: | ||
needs: build-and-push | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Deploy to Elastic Beanstalk | ||
uses: einaregilsson/beanstalk-deploy@v21 | ||
with: | ||
aws_access_key: ${{ secrets.AWS_ACCESS_KEY }} | ||
aws_secret_key: ${{ secrets.AWS_SECRET_KEY }} | ||
application_name: ${{ secrets.EB_APP_NAME }} | ||
environment_name: ${{ secrets.EB_ENV_NAME }} | ||
region: ${{ secrets.EB_REGION }} | ||
version_label: "version-${{ github.run_number }}" #OR ${{ github.sha }} | ||
deployment_package: docker-compose.yml |
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,35 +1,36 @@ | ||
version: '3.8' | ||
|
||
services: | ||
backend: | ||
build: | ||
context: ./backend | ||
image: ${DOCKER_USERNAME}/langjam-backend | ||
ports: | ||
- "3000:3000" | ||
environment: | ||
- GOOGLE_API_KEY=$GOOGLE_API_KEY | ||
- MONGO_URI=$MONGO_URI | ||
- MONGO_PW=$MONGO_PW | ||
- PORT=$PORT | ||
- JWT_KEY=$JWT_KEY | ||
- JWT_VERIFY_KEY=$JWT_VERIFY_KEY | ||
- JWT_ADMIN_KEY=$JWT_ADMIN_KEY | ||
- GEMINI_KEY=$GEMINI_KEY | ||
- REDIS_PASSWORD=$REDIS_PASSWORD | ||
- REDIS_URI=$REDIS_URI | ||
- OAUTH_CLIENT_ID=$OAUTH_CLIENT_ID | ||
- OAUTH_CLIENT_SECRET=$OAUTH_CLIENT_SECRET | ||
- CLIENT_URL=$CLIENT_URL | ||
- GOOGLE_API_KEY=${GOOGLE_API_KEY} | ||
- MONGO_URI=${MONGO_URI} | ||
- MONGO_PW=${MONGO_PW} | ||
- PORT=${PORT} | ||
- JWT_KEY=${JWT_KEY} | ||
- JWT_VERIFY_KEY=${JWT_VERIFY_KEY} | ||
- JWT_ADMIN_KEY=${JWT_ADMIN_KEY} | ||
- GEMINI_KEY=${GEMINI_KEY} | ||
- REDIS_PASSWORD=${REDIS_PASSWORD} | ||
- REDIS_URI=${REDIS_URI} | ||
- OAUTH_CLIENT_ID=${OAUTH_CLIENT_ID} | ||
- OAUTH_CLIENT_SECRET=${OAUTH_CLIENT_SECRET} | ||
- CLIENT_URL=${CLIENT_URL} | ||
volumes: | ||
- /app/node_modules | ||
- ./backend:/app | ||
|
||
frontend: | ||
build: | ||
context: ./frontend | ||
image: ${DOCKER_USERNAME}/langjam-frontend | ||
ports: | ||
- "80:80" | ||
volumes: | ||
- /app/node_modules | ||
- ./frontend:/app | ||
environment: | ||
- VITE_REACT_APP_API_URL=$VITE_REACT_APP_API_URL | ||
- VITE_REACT_APP_API_URL=${VITE_REACT_APP_API_URL} | ||
depends_on: | ||
- backend |