1 minute read

ㅡ Builds, Deploy using a docker

toy-project docker

Table of Contents

Introduction

docker 를 이용한 front-end, back-end project build, deploy

Prerequisite

Must run in the docker environment.

Development

Testing

$ docker run -it -p 8080:8080 -rm [repository name : tag]

Commit

We are following Angular’s commitizen rules for formatting git commit message. This allows you to read messages that are easy to understand when looking for project history. It also uses the git commit message to generate our CHANGELOG file.

$ npm install -g git-cz
$ git add .
$ git git-cz
$ git push

Role

docker 를 이용해 front, back 을 직접 build, deploy 하는 과정을 거칩니다. 이를 통해 인프라 전반에 걸쳐 이해하는것을 목표

Result

Docker run front-end

d1

Front 프로젝트를 docker에 배포할 수 있는 image 로 만들고 run 시켰습니다. 이전에는 로컬 환경에서 직접 실행하여 서버를 구동했다면 현재는 docker를 서버로 두어 image 형태로 컨테이너들을 관리할 수 있는 사실이 무척 신기하였습니다.

Docker run back-end

d2

d3

마찬가지로 back 프로젝트를 docker에서 배포할 수 있는 image로 만들었고 run 시켰습니다. 실행 이후 swagger를 확인하며 api 명세서를 확인할 수 있었습니다.

d4

d5

Docker run mysql

d6

mysql 도 docker에 배포할 수 있는 image로 만들고 run 시켰습니다. 실제로 데이터베이스 자체를 image 로 관리하여 배포하여 access 를 할 수 있는 사실이 흥미로웠고, docker image 가 크기 않다는 점에서 인프라 구축에 docker가 현업에서의 활용 가능성에 대해 리서치해볼 수 있는 좋은 시간이었습니다.

Docker issue

d7

mysql image를 생성하고 docker 에 올라가지 않는 현상이 있었습니다. 다음 솔루션을 통해 해결할 수 있었습니다. docker rmi [docker id] 이후 image 로 생성 한 후 run 하여 해결 할 수 있었습니다.

수정된 코드

docker run --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=### -e MYSQL_DATABASE=### -d mysql --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci

license

MIT License

About

Authored and maintained by ingyu

Categories:

Updated: