Compare commits
13 Commits
21bfd0565c
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 42c42e750e | |||
| c689426224 | |||
| 1649b9702c | |||
| 52b2daee6f | |||
| 5e4285e1ad | |||
| 99056b3b80 | |||
| 6871907324 | |||
| 5e1eb2fa7a | |||
| 869d2e1f21 | |||
| 09428a8414 | |||
| e645480f22 | |||
| f0577f55db | |||
| de8ef086f0 |
@@ -1,35 +1,36 @@
|
|||||||
variables:
|
|
||||||
IMAGE: flask-demo:latest
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
- name: dockersock
|
|
||||||
host:
|
|
||||||
path: /var/run/docker.sock
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
test:
|
test:
|
||||||
image: python:3.11
|
image: "python:3.11"
|
||||||
commands:
|
commands:
|
||||||
- pip install -r requirements.txt
|
- pip install -r requirements.txt
|
||||||
- pytest -q
|
- pytest -q
|
||||||
|
when:
|
||||||
|
event: [push, manual]
|
||||||
|
|
||||||
build:
|
build:
|
||||||
image: docker:27-cli
|
image: "docker:27-cli"
|
||||||
volumes:
|
volumes:
|
||||||
- name: dockersock
|
- name: dockersock
|
||||||
path: /var/run/docker.sock
|
path: /var/run/docker.sock
|
||||||
|
environment:
|
||||||
|
IMAGE: "flask-demo:latest"
|
||||||
commands:
|
commands:
|
||||||
- docker build -t ${IMAGE} .
|
- docker build -t "$IMAGE" .
|
||||||
|
when:
|
||||||
|
event: [push, manual]
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
image: docker:27-cli
|
image: "docker:27-cli"
|
||||||
volumes:
|
volumes:
|
||||||
- name: dockersock
|
- name: dockersock
|
||||||
path: /var/run/docker.sock
|
path: /var/run/docker.sock
|
||||||
commands:
|
commands:
|
||||||
- docker compose up -d
|
- docker compose up -d
|
||||||
when:
|
when:
|
||||||
event:
|
event: [push, manual]
|
||||||
- push
|
branch: [main]
|
||||||
branch:
|
|
||||||
- main
|
volumes:
|
||||||
|
- name: dockersock
|
||||||
|
host:
|
||||||
|
path: /var/run/docker.sock
|
||||||
|
|||||||
2
app.py
2
app.py
@@ -7,4 +7,4 @@ def home():
|
|||||||
return render_template("index.html", title="Flask CI/CD demo")
|
return render_template("index.html", title="Flask CI/CD demo")
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
app.run(host="0.0.0.0", port=8888) # внутри контейнера слушаем 8000
|
app.run(host="0.0.0.0", port=8008) # внутри контейнера слушаем 8000
|
||||||
|
|||||||
@@ -4,5 +4,5 @@ services:
|
|||||||
image: flask-demo:latest
|
image: flask-demo:latest
|
||||||
container_name: flask-demo
|
container_name: flask-demo
|
||||||
ports:
|
ports:
|
||||||
- "8888:8888"
|
- "8008:8008"
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|||||||
Reference in New Issue
Block a user