Skip to content

Commit 1e03311

Browse files
committed
Add Docker integration section
1 parent 16a2db9 commit 1e03311

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

index.adoc

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1522,6 +1522,60 @@ and check the web application at: <http://localhost:3000>
15221522

15231523
== Integrations
15241524

1525+
=== Docker
1526+
1527+
https://www.docker.com/[Docker] is a system for running software in
1528+
_containers_ -- isolated and virtual environments designed to run an
1529+
application.
1530+
1531+
To create a Docker container for your Duct application, you will need a
1532+
`Dockerfile` that describes how to build it. Duct will set one up for
1533+
you with the `--init-docker` option.
1534+
1535+
[,shell]
1536+
----
1537+
$ duct --init-docker
1538+
Created Dockerfile
1539+
----
1540+
1541+
To build the container, run:
1542+
1543+
[,shell]
1544+
----
1545+
$ docker build . -t <container-name>
1546+
----
1547+
1548+
This will create a container with all the dependencies downloaded. It
1549+
will also handle any compilation from keys deriving from
1550+
`:duct/compiler`. This means that your ClojureScript will be compiled,
1551+
if you're using the ClojureScript module.
1552+
1553+
To run the container:
1554+
1555+
[,shell]
1556+
----
1557+
$ docker run -p 3000:3000 <container-name>
1558+
----
1559+
1560+
This will start the Duct application and bind the container port 3000 to
1561+
the host machine's port 3000 so you can access your application at:
1562+
<http://localhost:3000>
1563+
1564+
This container is configured to only run keys deriving from
1565+
`:duct/daemon` (and those it references). This includes keys like
1566+
`:duct.server.http/jetty` provided by the web module. This will exclude
1567+
migrations in order avoid multiple containers behind a load balancer all
1568+
trying to update the database at once.
1569+
1570+
In order to run the migrations, you'll need to run Duct in your
1571+
deployment environment with only the `:duct/migrator` keys. This should
1572+
be part of your deployment scripts and run *once* each time you deploy.
1573+
1574+
[,shell]
1575+
----
1576+
clojure -M:duct -mvk :duct/migrator
1577+
----
1578+
15251579
=== Emacs
15261580

15271581
https://www.gnu.org/software/emacs/[Emacs] is a popular editor for

0 commit comments

Comments
 (0)