infra/codestorage/hg-repo-sync

Paddy 2015-10-11 Parent:d8c86bc750ad Child:9cc2f3a01ab5

1:cc08c8ed2128 Go to Latest

infra/codestorage/hg-repo-sync/Dockerfile

Update to be more modular. We now have a more modular approach to running our mercurial servers, and the approach to the individual containers is a bit more modular as well. The hg-repo-sync container now has a few responsibilities: 1. Install Mercurial 2. Create the group that’s going to be writing all our files 3. Create the folders we’ll store files in, and make the new group the owner 4. Define a script that pulls repos from GCS to local disk 5. Define a script that pushes repos to GCS from local disk 6. Define a script that causes a delay between runs This mainly involved breaking the previous run script into a few separate scripts, so they could be invoked individually. This docker container _can_ be used as a standalone image that will keep the local disk in sync with GCS, but it’s more useful as a base image for our other containers to work off of to achieve specialised functionality.

History
     1.1 --- a/Dockerfile	Mon Aug 17 18:56:19 2015 -0400
     1.2 +++ b/Dockerfile	Sun Oct 11 03:48:40 2015 -0700
     1.3 @@ -2,18 +2,28 @@
     1.4  MAINTAINER Paddy <paddy@secondbit.org>
     1.5  
     1.6  RUN apt-get update && apt-get install -y Mercurial wget unzip
     1.7 -RUN adduser --disabled-password --gecos "" -uid 2000 hg
     1.8 +RUN groupadd -g 2000 committers
     1.9  
    1.10 -RUN mkdir -p /scratch
    1.11 -RUN mkdir -p /current
    1.12 +RUN mkdir -p /mounted/repos
    1.13 +RUN chown -R root:committers /mounted/repos
    1.14 +RUN chmod 0770 /mounted/repos
    1.15  
    1.16 -VOLUME /current
    1.17 -VOLUME /scratch
    1.18 +VOLUME /mounted
    1.19  
    1.20 -ADD run.sh /etc/run.sh
    1.21 -RUN chmod +x /etc/run.sh
    1.22 +RUN mkdir -p /tmp/repos
    1.23 +RUN chown -R root:committers /tmp/repos
    1.24 +RUN chmod 0770 /tmp/repos
    1.25  
    1.26 -ADD hgrc /etc/mercurial/hgrc
    1.27 +ADD run.sh /usr/local/bin/helpers/run.sh
    1.28 +ADD sleep.sh /usr/local/bin/helpers/sleep.sh
    1.29 +ADD pull.sh /usr/local/bin/helpers/pull.sh
    1.30 +ADD push.sh /usr/local/bin/helpers/push.sh
    1.31 +RUN chmod +x /usr/local/bin/helpers/run.sh
    1.32 +RUN chmod +x /usr/local/bin/helpers/sleep.sh
    1.33 +RUN chmod +x /usr/local/bin/helpers/pull.sh
    1.34 +RUN chmod +x /usr/local/bin/helpers/push.sh
    1.35 +
    1.36 +ADD hgrc /usr/local/bin/helpers/mercurial/hgrc
    1.37  RUN wget https://dl.google.com/dl/cloudsdk/release/google-cloud-sdk.zip && unzip google-cloud-sdk.zip && rm google-cloud-sdk.zip
    1.38  
    1.39  ENV CLOUDSDK_PYTHON_SITEPACKAGES 1
    1.40 @@ -24,4 +34,4 @@
    1.41  ENV PATH /google-cloud-sdk/bin:$PATH
    1.42  ENV HOME /
    1.43  
    1.44 -ENTRYPOINT ["/etc/run.sh"]
    1.45 +CMD ["/usr/local/bin/helpers/run.sh"]