Conduit: Create Docker container for Mercurial Server (Bug 1346949). r?mars draft
authorDavid Walsh <dwalsh@mozilla.com>
Mon, 13 Mar 2017 16:11:48 -0500
changeset 367 37050a9e2f0223827a416ed1aadb5f89e283214a
parent 362 3733921812d2f96ef7c7cc68f405277bcedacb0e
child 368 8353b7b453d3ee1be25aa791ced1f2f411dce4e8
push id158
push userbmo:dwalsh@mozilla.com
push dateTue, 14 Mar 2017 17:53:49 +0000
reviewersmars
bugs1346949
Conduit: Create Docker container for Mercurial Server (Bug 1346949). r?mars This docker container provides a public endpoint for mercurial server, as well as a sidecar container to generate the 'testrepo' which can be cloned and pushed to. MozReview-Commit-ID: KbdwHHDe8nr
staginghgserver/docker-compose.yml
staginghgserver/docker/Dockerfile
staginghgserver/docker/entrypoint.sh
staginghgserver/docker/hgweb.conf
new file mode 100644
--- /dev/null
+++ b/staginghgserver/docker-compose.yml
@@ -0,0 +1,37 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+version: '2'
+services:
+  hgserver:
+    build:
+      context: ./docker
+      dockerfile: ./Dockerfile
+    ports:
+      - "8080:8080"
+    volumes:
+      - data-volume:/repos
+      - ./docker/hgweb.conf:/etc/hg/hgweb.conf
+    environment:
+      - HG_RELEASE=4.1
+      - HG_WEB_CONF=/etc/hg/hgweb.conf
+    depends_on:
+      - hgrepoinit
+
+  hgrepoinit:
+    build:
+      context: ./docker
+      dockerfile: ./Dockerfile
+    volumes:
+      - data-volume:/repos
+    environment:
+      - HG_RELEASE=4.1
+      - HG_WEB_CONF=/etc/hg/hgweb.conf
+    entrypoint:
+      - hg
+      - init
+      - /repos/testrepo
+
+volumes:
+  data-volume:
new file mode 100644
--- /dev/null
+++ b/staginghgserver/docker/Dockerfile
@@ -0,0 +1,23 @@
+FROM alpine
+
+ENV HG_RELEASE=4.1 \
+    HG_WEB_CONF=/etc/hg/hgweb.conf
+
+RUN mkdir -p /etc/hg
+
+RUN apk --no-cache add python
+RUN apk --no-cache add --virtual build-dependencies \
+      build-base \
+      python-dev \
+      py-pip \
+    && pip install --no-cache mercurial==$HG_RELEASE \
+    && apk del build-dependencies
+
+COPY entrypoint.sh /entrypoint.sh
+RUN chmod +x /entrypoint.sh
+
+VOLUME ["/repos"]
+
+EXPOSE 8080
+
+ENTRYPOINT ["/entrypoint.sh"]
new file mode 100644
--- /dev/null
+++ b/staginghgserver/docker/entrypoint.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+cd /repos
+exec hg serve --port 8080 --web-conf ${HG_WEB_CONF}
new file mode 100644
--- /dev/null
+++ b/staginghgserver/docker/hgweb.conf
@@ -0,0 +1,6 @@
+[paths]
+testrepo = /repos/testrepo
+
+[web]
+allow_push = *
+push_ssl = false