Docker Compose in 12 Minutes · sal-notes/tutorials@6232487 · GitHub
Skip to content

Commit 6232487

Browse files
committed
Docker Compose in 12 Minutes
0 parents  commit 6232487

8 files changed

Lines changed: 103 additions & 0 deletions

File tree

LICENSE.md

Lines changed: 21 additions & 0 deletions

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Tutorials
2+
3+
<img align="right" src="http://i.giphy.com/QHE5gWI0QjqF2.gif" width="260 "/>
4+
5+
This repository contains the source code from the YouTube tutorials at http://youtube.com/jaketvee.

docker/02-docker-compose/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Docker Compose in 12 Minutes
2+
3+
Docker compose is a tool for defining and running multi-container Docker applications. In this tutorial I show you the basics of Docker Compose, including how to write a `docker-compose.yml` file for a simple two-container e-commerce style website.
4+
5+
[Watch Docker Compose in 12 Minutes on YouTube](https://youtu.be/Qw9zlE3t8Ko)
6+
7+
# Getting started
8+
9+
This directory contains the source code from the tutorial. To run the application, `cd` into this directory and run `docker-compose up`. The product service and the website will start (if necessary, docker-compose will automatically build the containers).
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
version: '3'
2+
3+
services:
4+
product-service:
5+
build: ./product
6+
volumes:
7+
- ./product:/usr/src/app
8+
ports:
9+
- 5001:80
10+
11+
website:
12+
image: php:apache
13+
volumes:
14+
- ./website:/var/www/html
15+
ports:
16+
- 5000:80
17+
depends_on:
18+
- product-service
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM python:3-onbuild
2+
COPY . /usr/src/app
3+
CMD ["python", "api.py"]
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Product Service
2+
3+
# Import framework
4+
from flask import Flask
5+
from flask_restful import Resource, Api
6+
7+
# Instantiate the app
8+
app = Flask(__name__)
9+
api = Api(app)
10+
11+
class Product(Resource):
12+
def get(self):
13+
return {
14+
'products': ['Ice cream', 'Chocolate', 'Fruit', 'Eggs']
15+
}
16+
17+
# Create routes
18+
api.add_resource(Product, '/')
19+
20+
# Run the application
21+
if __name__ == '__main__':
22+
app.run(host='0.0.0.0', port=80, debug=True)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Flask==0.12
2+
flask-restful==0.3.5
Lines changed: 23 additions & 0 deletions

0 commit comments

Comments
 (0)