-
Notifications
You must be signed in to change notification settings - Fork 1
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
7636ee3
commit e9b0d31
Showing
3 changed files
with
34 additions
and
63 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
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,60 +1,54 @@ | ||
name: Sharingan Deploy Core | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
commit-sha: | ||
description: "SHA of the latest commit in the pull request" | ||
required: true | ||
pull_request: | ||
branches: | ||
- main | ||
push: | ||
branches: | ||
- main | ||
- dev | ||
paths: | ||
- 'apps/core/src/**' | ||
|
||
env: | ||
IMAGE_TAG: tericcabrel/sharingan-core:${{ github.event.inputs.commit-sha }} | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }} | ||
|
||
jobs: | ||
package: | ||
if: false | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Copy the core Dockerfile in the root repository | ||
run: cp apps/core/Dockerfile . | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ env.IMAGE_TAG }} | ||
- name: Build, tag, and push docker image to Amazon ECR | ||
env: | ||
REGISTRY: public.ecr.aws/x9y5g9l2 | ||
REGION: us-east-1 # Public ECR aren't region specific | ||
REPOSITORY: sharingan | ||
IMAGE_TAG: latest | ||
run: | | ||
aws ecr-public get-login-password --region $REGION | docker login --username AWS --password-stdin $REGISTRY | ||
docker build -t $REPOSITORY:$IMAGE_TAG . | ||
docker tag $REPOSITORY:$IMAGE_TAG $REGISTRY/$REPOSITORY:$IMAGE_TAG | ||
docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG | ||
deploy: | ||
defaults: | ||
run: | ||
working-directory: apps/core | ||
runs-on: ubuntu-latest | ||
environment: Production | ||
needs: | ||
- package | ||
# needs: | ||
# - package | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Add Server key | ||
run: | | ||
touch key.txt && echo "${{ secrets.SERVER_KEY }}" > key.txt | ||
chmod 600 key.txt | ||
|
||
- name: Deploy the application | ||
env: | ||
AWS_REGION: eu-west-1 | ||
run: | | ||
export SUSER=${{ secrets.SERVER_USER }} | ||
export SNAME=${{ secrets.SERVER_NAME }} | ||
export SPORT=${{ secrets.SERVER_PORT }} | ||
export IMAGE_TAG=$IMAGE_TAG | ||
./deploy.sh | ||
touch file.json && echo "${{ secrets.CORE_APP_ARN }}" > file.json | ||
ls -lh | ||
aws apprunner start-deployment --region $AWS_REGION --cli-input-json file:https://file.json |
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 |
---|---|---|
|
@@ -4,7 +4,7 @@ RUN mkdir app | |
|
||
WORKDIR /app | ||
|
||
COPY ../.. . | ||
COPY . . | ||
|
||
RUN yarn install | ||
|
||
|