Skip to content

jel-lambda/docker-example

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

13 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

docker-example

Description

  • backend: Django (django-admin startproject backend์œผ๋กœ ์ƒ์„ฑ)

  • frontend: React.js (npx create-react-app frontend์œผ๋กœ ์ƒ์„ฑ)

  • db: PostgreSQL ์‚ฌ์šฉ

์‚ฌ์šฉ๋ฒ•

  • requirements.txt์— ํ•„์š”ํ•œ ๋ชจ๋“ˆ์„ ๋‹ด์•„๋‘”๋‹ค

  • frontend์—์„œ npm i๋ฅผ ํ•ด์„œ ๋ชจ๋“ˆ์„ ์ตœ์‹ ํ™”ํ•œ๋‹ค

  • ํ”„๋กœ์ ํŠธ ๋ฃจํŠธ ๋””๋ ‰ํ† ๋ฆฌ์—์„œ docker compose up --build๋ฅผ ํ•œ๋‹ค

  • ์„œ๋ฒ„๋ฅผ ๋‚ด๋ฆด ๋• docker compose down์„ ํ•˜๊ณ , ์‚ญ์ œํ•  ๋•Œ๋Š” docker compose down -v๋ฅผ ํ•œ๋‹ค

  • ๋‹ค์‹œ ์˜ฌ๋ฆด ๋• docker compose up์„ ํ•œ๋‹ค (์‚ญ์ œ ํ›„์— ๋Œ๋ฆด ๋• --build ๋ฅผ ๋ถ™์—ฌ์ค€๋‹ค (์ฒ˜์Œ์—๋งŒ ๋นŒ๋“œ!))

  • production build์—๋Š” NGINX๊ฐ€ ํฌํ•จ๋˜์–ด ์žˆ์Œ

  • production build๋กœ ์‹คํ–‰ํ•˜๋ ค๋ฉด ์œ„์˜ ๋ช…๋ น์–ด๋“ค (docker compose) ๋’ค์— -f docker-compose.prod.yml ๋ช…๋ น์–ด๋ฅผ ๋ถ™์—ฌ์„œ ์‚ฌ์šฉํ•˜๋ฉด ๋œ๋‹ค (e.g., docker compose -f docker-compose.prod.yml up)

env ํŒŒ์ผ ๊ด€๋ฆฌ

  • settings ๋””๋ ‰ํ† ๋ฆฌ์— dev, prod ๋ฒ„์ „์˜ env ํŒŒ์ผ์ด ์กด์žฌํ•œ๋‹ค

About

A docker example using Django + Gunicorn, React, PostgreSQL and Nginx.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 53.6%
  • JavaScript 15.2%
  • HTML 13.9%
  • Dockerfile 9.8%
  • CSS 7.5%