chore: implement new image parsing rule
This commit is contained in:
parent
469f1f6122
commit
cbb1f0575d
4 changed files with 86 additions and 14 deletions
|
@ -42,12 +42,19 @@ class Parser:
|
||||||
service_image: Optional[str] = None
|
service_image: Optional[str] = None
|
||||||
if service.get("build"):
|
if service.get("build"):
|
||||||
if type(service["build"]) is str:
|
if type(service["build"]) is str:
|
||||||
service_image = "build from " + service["build"]
|
service_image = f"build from '{service['build']}'"
|
||||||
elif type(service["build"]) is dict:
|
elif type(service["build"]) is dict:
|
||||||
assert service["build"].get("context"), "Missing build context, aborting."
|
if service["build"].get("context") and service["build"].get("dockerfile"):
|
||||||
service_image = "build from " + str(service["build"]["context"])
|
service_image = (
|
||||||
elif service.get("image"):
|
f"build from '{service['build']['context']}' using '{service['build']['dockerfile']}'"
|
||||||
service_image = service["image"]
|
)
|
||||||
|
elif service["build"].get("context"):
|
||||||
|
service_image = f"build from '{service['build']['context']}'"
|
||||||
|
if service.get("image"):
|
||||||
|
if service_image:
|
||||||
|
service_image += ", image: " + service["image"]
|
||||||
|
else:
|
||||||
|
service_image = service["image"]
|
||||||
|
|
||||||
service_networks: List[str] = []
|
service_networks: List[str] = []
|
||||||
if service.get("networks"):
|
if service.get("networks"):
|
||||||
|
|
|
@ -23,8 +23,9 @@ services:
|
||||||
volumes:
|
volumes:
|
||||||
- ./api:/usr/src
|
- ./api:/usr/src
|
||||||
depends_on:
|
depends_on:
|
||||||
- postgres
|
- db
|
||||||
- adminer
|
- adminer
|
||||||
|
- redis
|
||||||
command: ["npm", "start"]
|
command: ["npm", "start"]
|
||||||
|
|
||||||
frontend:
|
frontend:
|
||||||
|
@ -38,22 +39,34 @@ services:
|
||||||
- 3000
|
- 3000
|
||||||
ports:
|
ports:
|
||||||
- 3000:3000
|
- 3000:3000
|
||||||
environment:
|
|
||||||
- REACT_APP_ENV=development
|
|
||||||
- BACKEND=api:8000
|
|
||||||
- HTTPS=true
|
|
||||||
- NODE_PATH=/usr/src/
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./frontend:/usr/src
|
- ./frontend:/usr/src
|
||||||
depends_on:
|
depends_on:
|
||||||
- api
|
- api
|
||||||
command: ["npm", "start"]
|
command: ["npm", "start"]
|
||||||
|
|
||||||
postgres:
|
db:
|
||||||
image: postgres
|
image: "awesome/db"
|
||||||
|
extends:
|
||||||
|
service: postgres
|
||||||
|
from: postgres.yml
|
||||||
restart: always
|
restart: always
|
||||||
|
volumes:
|
||||||
|
- "db-data:/data"
|
||||||
|
- type: bind
|
||||||
|
source: /var/run/postgres/postgres.sock
|
||||||
|
target: /var/run/postgres/postgres.sock
|
||||||
|
|
||||||
|
redis:
|
||||||
|
image: "awesome/redis"
|
||||||
|
restart: always
|
||||||
|
expose:
|
||||||
|
- 6379
|
||||||
|
|
||||||
adminer:
|
adminer:
|
||||||
image: adminer
|
image: "awesome/adminer"
|
||||||
ports:
|
ports:
|
||||||
- 8080:8080
|
- 8080:8080
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
db-data:
|
||||||
|
|
5
examples/full-stack-node-app/postgres.yml
Normal file
5
examples/full-stack-node-app/postgres.yml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
version: "3.9"
|
||||||
|
|
||||||
|
services:
|
||||||
|
postgres:
|
||||||
|
image: awesome/postgres
|
47
examples/non-normative/docker-compose.yml
Normal file
47
examples/non-normative/docker-compose.yml
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
services:
|
||||||
|
frontend:
|
||||||
|
image: awesome/webapp
|
||||||
|
networks:
|
||||||
|
- front-tier
|
||||||
|
- back-tier
|
||||||
|
|
||||||
|
monitoring:
|
||||||
|
image: awesome/monitoring
|
||||||
|
networks:
|
||||||
|
- admin
|
||||||
|
|
||||||
|
|
||||||
|
backend:
|
||||||
|
networks:
|
||||||
|
back-tier:
|
||||||
|
aliases:
|
||||||
|
- database
|
||||||
|
admin:
|
||||||
|
aliases:
|
||||||
|
- mysql
|
||||||
|
volumes:
|
||||||
|
- type: volume
|
||||||
|
source: db-data
|
||||||
|
target: /data
|
||||||
|
volume:
|
||||||
|
nocopy: true
|
||||||
|
- type: bind
|
||||||
|
source: /var/run/postgres/postgres.sock
|
||||||
|
target: /var/run/postgres/postgres.sock
|
||||||
|
depends_on:
|
||||||
|
- monitoring
|
||||||
|
extends:
|
||||||
|
service: frontend
|
||||||
|
ports:
|
||||||
|
- "8000:5010"
|
||||||
|
links:
|
||||||
|
- "db:database"
|
||||||
|
db:
|
||||||
|
image: postgres
|
||||||
|
|
||||||
|
networks:
|
||||||
|
front-tier:
|
||||||
|
back-tier:
|
||||||
|
admin:
|
||||||
|
volumes:
|
||||||
|
db-data:
|
Loading…
Reference in a new issue