-
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.
Docker setup with ECR and GitHub actions
- Loading branch information
Showing
23 changed files
with
205 additions
and
35 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,62 @@ | ||
name: CD/ECR | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
env: | ||
AWS_REGION: us-east-1 | ||
|
||
jobs: | ||
build: | ||
name: ECR | ||
|
||
strategy: | ||
matrix: | ||
service: [service-app, service-capital, service-clans, service-wars] | ||
|
||
runs-on: buildjet-4vcpu-ubuntu-2204-arm | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: ${{ env.AWS_REGION }} | ||
|
||
- name: Get ECR Registry | ||
id: ecr-login | ||
uses: aws-actions/amazon-ecr-login@v1 | ||
|
||
- name: Login to ECR | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ${{ steps.ecr-login.outputs.registry }} | ||
|
||
- name: Set up Docker Buildkit | ||
uses: docker/setup-buildx-action@v2 | ||
with: | ||
buildkitd-flags: --debug | ||
|
||
- name: Get Tags for Image | ||
id: metadata | ||
uses: docker/metadata-action@v3 | ||
with: | ||
images: ${{ steps.ecr-login.outputs.registry }}/${{ matrix.service }} | ||
tags: | | ||
type=raw,value=latest | ||
- name: Docker Build, Tag and Push to ECR | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
platforms: linux/arm64 | ||
push: true | ||
tags: ${{ steps.metadata.outputs.tags }} | ||
build-args: GIT_SHA=${{ github.sha }},SERVICE_NAME=${{ matrix.service }} |
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,25 @@ | ||
name: CI/CD | ||
|
||
on: | ||
push: | ||
pull_request: | ||
|
||
jobs: | ||
lint: | ||
name: ESLint | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Use Node.js 18 | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
|
||
- name: NPM Install | ||
run: npm ci | ||
|
||
- name: Run ESLint | ||
run: npm run lint |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
apps/service-cron/test/app.e2e-spec.ts → apps/service-app/test/app.e2e-spec.ts
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
File renamed without changes.
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
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
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 @@ | ||
version: '3.6' | ||
|
||
services: | ||
service-app: | ||
image: 432159388664.dkr.ecr.us-east-1.amazonaws.com/service-app:latest | ||
container_name: service-app | ||
restart: always | ||
# build: | ||
# context: . | ||
# dockerfile: Dockerfile | ||
env_file: | ||
- .env | ||
mem_limit: 1gb | ||
environment: | ||
- SERVICE_NAME=service-app | ||
|
||
service-capital: | ||
image: 432159388664.dkr.ecr.us-east-1.amazonaws.com/service-capital:latest | ||
container_name: service-capital | ||
restart: always | ||
# build: | ||
# context: . | ||
# dockerfile: Dockerfile | ||
env_file: | ||
- .env | ||
mem_limit: 1gb | ||
environment: | ||
- SERVICE_NAME=service-capital | ||
|
||
service-clans: | ||
image: 432159388664.dkr.ecr.us-east-1.amazonaws.com/service-clans:latest | ||
container_name: service-clans | ||
restart: always | ||
# build: | ||
# context: . | ||
# dockerfile: Dockerfile | ||
env_file: | ||
- .env | ||
mem_limit: 1gb | ||
environment: | ||
- SERVICE_NAME=service-clans | ||
|
||
service-wars: | ||
image: 432159388664.dkr.ecr.us-east-1.amazonaws.com/service-wars:latest | ||
container_name: service-wars | ||
restart: always | ||
# build: | ||
# context: . | ||
# dockerfile: Dockerfile | ||
env_file: | ||
- .env | ||
mem_limit: 1gb | ||
environment: | ||
- SERVICE_NAME=service-app | ||
|
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,7 +1,4 @@ | ||
import { Tokens } from '@app/constants'; | ||
import { Inject, Injectable } from '@nestjs/common'; | ||
import { Injectable } from '@nestjs/common'; | ||
|
||
@Injectable() | ||
export class ElasticService { | ||
constructor(@Inject(Tokens.ELASTIC) ) | ||
} | ||
export class ElasticService {} |
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,8 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { HelperService } from './helper.service'; | ||
|
||
@Module({ | ||
providers: [HelperService], | ||
exports: [HelperService], | ||
}) | ||
export class HelperModule {} |
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,4 @@ | ||
import { Injectable } from '@nestjs/common'; | ||
|
||
@Injectable() | ||
export class HelperService {} |
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,2 @@ | ||
export * from './helper.module'; | ||
export * from './helper.service'; |
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,9 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"compilerOptions": { | ||
"declaration": true, | ||
"outDir": "../../dist/libs/helper" | ||
}, | ||
"include": ["src/**/*"], | ||
"exclude": ["node_modules", "dist", "test", "**/*spec.ts"] | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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