yaml

Younghwan Cha·2022년 12월 30일
0

configuration

목록 보기
2/7
post-thumbnail
x-pgConfig: &pgConfig
	- name: "Cha"

# 위와 같이 환경변수를 변수로 정의하고
	config: *pgConfig
# 위와 같이 정의한 변수를 참조하여 사용 할 수 있다. 
# x- 는 그대로 쓰지 않고 &pgConfig 와 같이 
# 다른 이름으로 정의해서 사용할 것이라는 일종의 컨벤션
students: 
		- name: "Cha"
		- major: "cs"
		- age: 23

# toJSON
# students: [{name: "Cha"}, {major: "cs"}, {age: 23}]

students: 
		- name: "Cha"
			major: "cs"
			age: 23
# toJSON
# students: [{ name: "Cha", major: "cs", age: 23 }]
# 간단한 배열의 경우 묶어서 표현하기도 한다

favorites:
		- *MK
		- *MJ

favorites: [*MK, *MJ]
services:
  # Node.js gives OS info about the node (Host)
  nodeinfo: &function
    image: functions/nodeinfo:latest
    labels:
      function: "true"
    depends_on:
      - gateway
    networks:
      - functions
    environment:
      no_proxy: "gateway"
      https_proxy: $https_proxy
    deploy:
      placement:
        constraints:
          - 'node.platform.os == linux'
  # Uses `cat` to echo back response, fastest function to execute.
  echoit:
    <<: *function
    image: functions/alpine:health
    environment:
      fprocess: "cat"
      no_proxy: "gateway"
      https_proxy: $https_proxy

# << 는 키:값 세트를 맵핑해서 가져옴
# 이후에 필요한 값은 하단에 정의하여 덮어씌움
# \n 처리 여부

# "" =>  다음 줄
# '' =>  \n 문자

[ref]
https://medium.com/@kinghuang/docker-compose-anchors-aliases-extensions-a1e4105d70bd

profile
개발 기록

0개의 댓글