Education*
Devops
Architecture
F/B End
B.Chain
Basic
Others
CLOSE
Search For:
Search
BY TAGS
linux
HTTP
golang
flutter
java
fintech
개발환경
kubernetes
network
Docker
devops
database
tutorial
cli
분산시스템
www
블록체인
AWS
system admin
bigdata
보안
금융
msa
mysql
redis
Linux command
dns
javascript
CICD
VPC
FILESYSTEM
S3
NGINX
TCP/IP
ZOOKEEPER
NOSQL
IAC
CLOUD
TERRAFORM
logging
IT용어
Kafka
docker-compose
Dart
[샘플코드] 입문자를 위한 Docker and Dockerizing
Recommanded
Free
YOUTUBE Lecture:
<% selectedImage[1] %>
J.phil
2023-09-05
2023-08-28
1416
### [샘플코드] 입문자를 위한 Docker and Dockerizing <br>  해당 첨부파일은 인프런 - [입문자를 위한 Docker and Dockerizing](https://inf.run/vNpD) 특강에서 사용하는 샘플 코드입니다. 특강을 수강하시는 분들은 아래 링크를 통해 다운을 받은 후 코드랩을 진행해주세요. [download special_lecture_template](https://drive.google.com/file/d/1NMYMV9FKgBxUNevggYUIEdPPl26VHMDr/view?usp=sharing) <br> <br> --- ### Install Docker-Compose 여러분 Ubuntu 머신에 `Docker` 가 설치되었다는 가정하에 `Docker Compose` 설치를 안내하겠습니다. i. 만약 원하는 Version을 설치하고 싶으실 경우 v2.5.0 대신 다른 버전 명시 ``` $ sudo curl -L "https://github.com/docker/compose/releases/download/v2.5.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose ``` ii. 실행 권한 부여 ``` $ sudo chmod +x /usr/local/bin/docker-compose ``` iii. 설치 확인 ``` $ docker-compose --version ``` --- ### 실습 템플릿 코드 **node/Dockerfile** ```Dockerfile FROM node:16-alpine WORKDIR /app COPY package*.json ./ RUN npm install COPY index.js ./ ENTRYPOINT ["node", "index.js"] ``` **node/index.js** ```javascript const express = require('express'); const app = express(); /* */ const PORT=5000 app.get('/', (req, res) => res.send('Hello World')); app.get('/health', (req, res) => { /* */ }) app.listen(PORT, () => { console.log('node js server is running'); }) ``` **nginx/conf.d/app.conf** ``` server { location / { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } } ``` **docker-compose.yml** ```yml version: '3.8' services: test_web: restart: always build: context: ./nginx # ports: # - # depends_on: # - test_app: restart: always build: context: ./node # ports: # - # expose: # - # depends_on: # - test_db: restart: unless-stopped build: context: ./mysql # hostname: # ports: # - # environment: # MYSQL_DATABASE: test # MYSQL_ROOT_HOST: '%' # MYSQL_ROOT_PASSWORD: 1234 ``` **mysql 접속 방법 after docker-compose** ``` $ mysql -u root -p -h 127.0.0.1 -P 3308 ```
Recent Posts
Vertex Gemini 기반 AI 에이전트 개발 04. 프롬프트 엔지니어링
Vertex Gemini 기반 AI 에이전트 개발 03. Vertex AI Gemini 둘러보기
Vertex Gemini 기반 AI 에이전트 개발 02. 생성 AI에 대해서
Vertex Gemini 기반 AI 에이전트 개발 01. 소개
Vertex Gemini 기반 AI 에이전트 개발-소개
생성 AI 모델 Flux.1 설치 및 사용
GPT를 이용한 Reranker 테스트
5분만에 만들어보는 Streamlit 챗봇
Let's encrypt로 SSL 인증서 관리하기
Upscayl을 이용한 이미지 업스케일링
Archive Posts
Tags
devops
docker
docker-compose
nginx
NODEJS
Copyrights © -
Joinc
, All Rights Reserved.
Inherited From -
Yundream
Rebranded By -
Joonphil
Recent Posts
Archive Posts
Tags