Skip to content

Commit

Permalink
도커 배포 ecr 설정
Browse files Browse the repository at this point in the history
🚀 feat(ecr) : private ecr 도커 레지스트리 추가
  • Loading branch information
ImNM authored Jul 23, 2022
2 parents db50a15 + 36ec736 commit 7d54b60
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 47 deletions.
63 changes: 38 additions & 25 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: Docker
on:
push:
branches: [main]
# Publish semver tags as releases.
tags: ['v*.*.*']

Expand All @@ -11,27 +10,41 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
with:
images: water0641/tikitaka-api
tag-semver: |
{{version}}
{{major}}.{{minor}}
- 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: .
file: ./Dockerfile
platforms: linux/amd64
push: true
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}

- 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: ap-northeast-2

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: ${{ secrets.AWS_ECR_REPO}}
IMAGE_TAG: ${{version}}
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
# - 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: .
# file: ./Dockerfile
# platforms: linux/amd64
# push: true
# tags: ${{ steps.docker_meta.outputs.tags }}
# labels: ${{ steps.docker_meta.outputs.labels }}
17 changes: 15 additions & 2 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
{
"arrowParens": "avoid",
"bracketSpacing": true,
"htmlWhitespaceSensitivity": "css",
"insertPragma": false,
"jsxBracketSameLine": false,
"jsxSingleQuote": false,
"printWidth": 80,
"proseWrap": "preserve",
"quoteProps": "as-needed",
"requirePragma": false,
"semi": true,
"singleQuote": true,
"trailingComma": "all"
}
"tabWidth": 2,
"trailingComma": "none",
"useTabs": false
}
14 changes: 7 additions & 7 deletions src/apis/alarm/alarm.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,24 @@ import { RoomsModule } from '../rooms/rooms.module';
forwardRef(() => UserModule),
BullModule.registerQueue(
{
name: PUSH_ALARM,
name: PUSH_ALARM
},
{
name: SAVE_ALARM,
},
name: SAVE_ALARM
}
),
FcmModule.forRoot({
credentialPath: path.join(__dirname, '../../../fcm-admin.json'),
credentialPath: path.join(__dirname, '../../../fcm-admin.json')
}),
RoomsModule,
RoomsModule
],
controllers: [NotiController],
providers: [
AlarmService,
AlarmRepository,
PushAlarmProcessor,
SaveAlarmProcessor,
SaveAlarmProcessor
],
exports: [AlarmService, AlarmRepository],
exports: [AlarmService, AlarmRepository]
})
export class AlarmModule {}
26 changes: 13 additions & 13 deletions src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ import * as Joi from 'joi';
redis: {
host: configService.get('REDIS_HOST'),
port: Number(configService.get('REDIS_PORT')),
retryStrategy: (times) => {
retryStrategy: times => {
// check connection
console.log('could not connect to redis!');
process.exit(1);
},
},
}
}
}),

inject: [ConfigService],
inject: [ConfigService]
}),
ConfigModule.forRoot({
isGlobal: true,
Expand All @@ -48,19 +48,19 @@ import * as Joi from 'joi';
SWAGGER_USER: Joi.string(),
SWAGGER_PASSWORD: Joi.string(),
REDIS_HOST: Joi.string(),
REDIS_PORT: Joi.number(),
}),
REDIS_PORT: Joi.number()
})
}),
MongooseModule.forRootAsync({
imports: [ConfigModule],
useFactory: async (configService: ConfigService) => ({
uri: configService.get<string>('MONGO_URI'),
connectionFactory: (connection) => {
connectionFactory: connection => {
connection.plugin(mongooseLeanDefaults);
return connection;
},
}
}),
inject: [ConfigService],
inject: [ConfigService]
}),
UserModule,
AuthModule,
Expand All @@ -69,14 +69,14 @@ import * as Joi from 'joi';
QuestionsModule,
AlarmModule,
FcmModule,
ChatModule,
ChatModule
],
providers: [
{
provide: APP_FILTER,
useClass: AllExceptionsFilter,
},
],
useClass: AllExceptionsFilter
}
]
})
export class AppModule implements NestModule {
private readonly isDev: boolean =
Expand Down

0 comments on commit 7d54b60

Please sign in to comment.