update
This commit is contained in:
parent
b15fffbd3e
commit
3d115aa945
8 changed files with 18 additions and 19 deletions
2
cli.html
2
cli.html
|
|
@ -6,7 +6,7 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link href='http://fonts.googleapis.com/css?family=Lilita+One|Lato:300,400,700' rel='stylesheet' type='text/css'>
|
||||
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
|
||||
<link rel="stylesheet" type="text/css" href="css/fig.css?20140807310306634594032">
|
||||
<link rel="stylesheet" type="text/css" href="css/fig.css?20140808310756672680036">
|
||||
<link rel="canonical" href="http://www.fig.sh/cli.html">
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link href='http://fonts.googleapis.com/css?family=Lilita+One|Lato:300,400,700' rel='stylesheet' type='text/css'>
|
||||
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
|
||||
<link rel="stylesheet" type="text/css" href="css/fig.css?20140807310306634594032">
|
||||
<link rel="stylesheet" type="text/css" href="css/fig.css?20140808310756672680036">
|
||||
<link rel="canonical" href="http://www.fig.sh/django.html">
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
|||
2
env.html
2
env.html
|
|
@ -6,7 +6,7 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link href='http://fonts.googleapis.com/css?family=Lilita+One|Lato:300,400,700' rel='stylesheet' type='text/css'>
|
||||
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
|
||||
<link rel="stylesheet" type="text/css" href="css/fig.css?20140807310306634594032">
|
||||
<link rel="stylesheet" type="text/css" href="css/fig.css?20140808310756672680036">
|
||||
<link rel="canonical" href="http://www.fig.sh/env.html">
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
|||
10
index.html
10
index.html
|
|
@ -6,7 +6,7 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link href='http://fonts.googleapis.com/css?family=Lilita+One|Lato:300,400,700' rel='stylesheet' type='text/css'>
|
||||
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
|
||||
<link rel="stylesheet" type="text/css" href="css/fig.css?20140807310306634594032">
|
||||
<link rel="stylesheet" type="text/css" href="css/fig.css?20140808310756672680036">
|
||||
<link rel="canonical" href="http://www.fig.sh/">
|
||||
</head>
|
||||
<body>
|
||||
|
|
@ -82,7 +82,7 @@ $ cd figtest
|
|||
redis
|
||||
</code></pre></div>
|
||||
<p>Next, we want to create a Docker image containing all of our app's dependencies. We specify how to build one using a file called <code>Dockerfile</code>:</p>
|
||||
<div class="highlight"><pre><code class="text language-text" data-lang="text">FROM orchardup/python:2.7
|
||||
<div class="highlight"><pre><code class="text language-text" data-lang="text">FROM python:2.7
|
||||
ADD . /code
|
||||
WORKDIR /code
|
||||
RUN pip install -r requirements.txt
|
||||
|
|
@ -100,18 +100,18 @@ RUN pip install -r requirements.txt
|
|||
links:
|
||||
- redis
|
||||
redis:
|
||||
image: orchardup/redis
|
||||
image: redis
|
||||
</code></pre></div>
|
||||
<p>This defines two services:</p>
|
||||
|
||||
<ul>
|
||||
<li><code>web</code>, which is built from <code>Dockerfile</code> in the current directory. It also says to run the command <code>python app.py</code> inside the image, forward the exposed port 5000 on the container to port 5000 on the host machine, connect up the Redis service, and mount the current directory inside the container so we can work on code without having to rebuild the image.</li>
|
||||
<li><code>redis</code>, which uses the public image <a href="https://index.docker.io/u/orchardup/redis/">orchardup/redis</a>. </li>
|
||||
<li><code>redis</code>, which uses the public image <a href="https://registry.hub.docker.com/_/redis/">redis</a>. </li>
|
||||
</ul>
|
||||
|
||||
<p>Now if we run <code>fig up</code>, it'll pull a Redis image, build an image for our own code, and start everything up:</p>
|
||||
<div class="highlight"><pre><code class="text language-text" data-lang="text">$ fig up
|
||||
Pulling image orchardup/redis...
|
||||
Pulling image redis...
|
||||
Building web...
|
||||
Starting figtest_redis_1...
|
||||
Starting figtest_web_1...
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link href='http://fonts.googleapis.com/css?family=Lilita+One|Lato:300,400,700' rel='stylesheet' type='text/css'>
|
||||
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
|
||||
<link rel="stylesheet" type="text/css" href="css/fig.css?20140807310306634594032">
|
||||
<link rel="stylesheet" type="text/css" href="css/fig.css?20140808310756672680036">
|
||||
<link rel="canonical" href="http://www.fig.sh/install.html">
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
|||
15
rails.html
15
rails.html
|
|
@ -6,7 +6,7 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link href='http://fonts.googleapis.com/css?family=Lilita+One|Lato:300,400,700' rel='stylesheet' type='text/css'>
|
||||
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
|
||||
<link rel="stylesheet" type="text/css" href="css/fig.css?20140807310306634594032">
|
||||
<link rel="stylesheet" type="text/css" href="css/fig.css?20140808310756672680036">
|
||||
<link rel="canonical" href="http://www.fig.sh/rails.html">
|
||||
</head>
|
||||
<body>
|
||||
|
|
@ -39,7 +39,7 @@ gem 'rails', '4.0.2'
|
|||
</code></pre></div>
|
||||
<p>Finally, <code>fig.yml</code> is where the magic happens. It describes what services our app comprises (a database and a web app), how to get each one's Docker image (the database just runs on a pre-made PostgreSQL image, and the web app is built from the current directory), and the configuration we need to link them together and expose the web app's port.</p>
|
||||
<div class="highlight"><pre><code class="text language-text" data-lang="text">db:
|
||||
image: orchardup/postgresql
|
||||
image: postgres
|
||||
ports:
|
||||
- "5432"
|
||||
web:
|
||||
|
|
@ -69,18 +69,17 @@ Rakefile db test
|
|||
<p>Now that we've got a new <code>Gemfile</code>, we need to build the image again. (This, and changes to the Dockerfile itself, should be the only times you'll need to rebuild).</p>
|
||||
<div class="highlight"><pre><code class="text language-text" data-lang="text">$ fig build
|
||||
</code></pre></div>
|
||||
<p>The app is now bootable, but we're not quite there yet. By default, Rails expects a database to be running on <code>localhost</code> - we need to point it at the <code>db</code> container instead. We also need to change the username and password to align with the defaults set by <code>orchardup/postgresql</code>.</p>
|
||||
<p>The app is now bootable, but we're not quite there yet. By default, Rails expects a database to be running on <code>localhost</code> - we need to point it at the <code>db</code> container instead. We also need to change the database and username to align with the defaults set by the <code>postgres</code> image.</p>
|
||||
|
||||
<p>Open up your newly-generated <code>database.yml</code>. Replace its contents with the following:</p>
|
||||
<div class="highlight"><pre><code class="text language-text" data-lang="text">development: &default
|
||||
adapter: postgresql
|
||||
encoding: unicode
|
||||
database: myapp_development
|
||||
database: postgres
|
||||
pool: 5
|
||||
username: docker
|
||||
password: docker
|
||||
host: <%= ENV.fetch('DB_1_PORT_5432_TCP_ADDR', 'localhost') %>
|
||||
port: <%= ENV.fetch('DB_1_PORT_5432_TCP_PORT', '5432') %>
|
||||
username: postgres
|
||||
password:
|
||||
host: db_1
|
||||
|
||||
test:
|
||||
<<: *default
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link href='http://fonts.googleapis.com/css?family=Lilita+One|Lato:300,400,700' rel='stylesheet' type='text/css'>
|
||||
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
|
||||
<link rel="stylesheet" type="text/css" href="css/fig.css?20140807310306634594032">
|
||||
<link rel="stylesheet" type="text/css" href="css/fig.css?20140808310756672680036">
|
||||
<link rel="canonical" href="http://www.fig.sh/wordpress.html">
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
|||
2
yml.html
2
yml.html
|
|
@ -6,7 +6,7 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link href='http://fonts.googleapis.com/css?family=Lilita+One|Lato:300,400,700' rel='stylesheet' type='text/css'>
|
||||
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
|
||||
<link rel="stylesheet" type="text/css" href="css/fig.css?20140807310306634594032">
|
||||
<link rel="stylesheet" type="text/css" href="css/fig.css?20140808310756672680036">
|
||||
<link rel="canonical" href="http://www.fig.sh/yml.html">
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue