목록Infra (16)
현제의 현재이야기

admin를 사용하려면 nginx에서 static을 처리해줬어야 했다. 근데 도저히 static 파일을 미리 모아두기 싫었다. 왜냐하면 static file들이 갱신될 수도 있는거고, 그럴 때마다 수동으로 collectstatic을 하면 불편하기 때문. 그래서 처음에는 nginx docker image가 만들어질 때, 같은 폴더의 static 폴더를 복사하도록 dockerfile을 만들었었다. 근데 nginx 폴더에 static 폴더가 있는건 너무 이상.. 그래서 진짜 몇 시간의 뻘짓을 하다가 드디어 성공했다. 그건 바로 docker의 volume 기능. 처음에 volume이 그저 host와 마운트 되어서 파일을 공유하는 기능인 줄 알았다. 하지만 volumes를 설정해서 컨테니어간 파일을 공유할 수도 ..
sudo docker-compose up 2023/07/25 06:24:28 must use ASL logging (which requires CGO) if running as root 2023/07/25 06:24:28 must use ASL logging (which requires CGO) if running as root [+] Running 0/0 ⠋ web Pulling 0.0s ⠋ nginx Pulling 0.0s [+] Building 0.7s (2/3) [+] Building 0.9s (3/3) FINISHED => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [internal] load build d..
docker-compose.yml version: '3' services: nginx: build: ./config/nginx ports: - "80:80" volumes: - .:/code - ./nginx/nginx:/etc/nginx.conf.d image: 11thbackend/nginx:latest depends_on: - web platform: linux/amd64 web: build: context: . dockerfile: Dockerfile command: gunicorn --bind 0.0.0.0:8000 hackathon.wsgi:application volumes: - .:/code #현재 호스트의 작업 디렉토리를 컨테이너 내부의 /code 로 마운팅 한다는 뜻 ports: - "..
linux/amd64의 도커 이미지가 필요하나 m1 칩으로 이미지를 만들 시 linux/arm64로 만들어진다. 따라서, 원래 docker image build를 할 때, --platform ~~ 으로 amd64로 만들어야 하나 docker-compose 환경에서는 docker-compose.yml에서 'platform'을 추가하여 빌드에 플랫폼의 운영체제로 지정할 수 있다. version: '3' services: nginx: build: ./config/nginx ports: - "80:80" volumes: - .:/code - ./nginx/nginx:/etc/nginx.conf.d image: 11thbackend/nginx:latest depends_on: - web platform: linu..
docker compose.yml에 키 값을 추가할 때마다 하드코딩을 하면 번거롭기 때문에 .env 파일을 두어서 관리하고자 한다. version: '3' services: green: container_name: green image: hjdeploy/test ports: - "8080:8080" # green은 8080 포트를 열어줍니다. env_file: - .env command: ["--spring.profiles.active=prod"] blue: container_name: blue image: hjdeploy/test ports: - "8081:8080" #blue는 8081 포트를 열어줍니다. env_file: - .env command: ["--spring.profiles.active=..

1. 도커 컴포즈 설치 2. docker-compose 작성 중요한 점은 deploy.sh와 같은 곳에 위치해야함 /home/ec2-user/ version: '3' services: green: container_name: green image: hjdeploy/test ports: - "8080:8080" # green은 8080 포트를 열어줍니다. environment: - DATASOURCE_URL= - DATASOURCE_USERNAME= - DATASOURCE_PASSWORD= blue: container_name: blue image: hjdeploy/test ports: - "8081:8080" #blue는 8081 포트를 열어줍니다. environment: - DATASOURCE_URL=..