infra/codestorage/hg-repo-sync
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.
2 MAINTAINER Paddy <paddy@secondbit.org>
4 RUN apt-get update && apt-get install -y Mercurial wget unzip
5 RUN groupadd -g 2000 committers
7 RUN mkdir -p /mounted/repos
8 RUN chown -R root:committers /mounted/repos
9 RUN chmod 0770 /mounted/repos
13 RUN mkdir -p /tmp/repos
14 RUN chown -R root:committers /tmp/repos
15 RUN chmod 0770 /tmp/repos
17 ADD run.sh /usr/local/bin/helpers/run.sh
18 ADD sleep.sh /usr/local/bin/helpers/sleep.sh
19 ADD pull.sh /usr/local/bin/helpers/pull.sh
20 ADD push.sh /usr/local/bin/helpers/push.sh
21 RUN chmod +x /usr/local/bin/helpers/run.sh
22 RUN chmod +x /usr/local/bin/helpers/sleep.sh
23 RUN chmod +x /usr/local/bin/helpers/pull.sh
24 RUN chmod +x /usr/local/bin/helpers/push.sh
26 ADD hgrc /usr/local/bin/helpers/mercurial/hgrc
27 RUN wget https://dl.google.com/dl/cloudsdk/release/google-cloud-sdk.zip && unzip google-cloud-sdk.zip && rm google-cloud-sdk.zip
29 ENV CLOUDSDK_PYTHON_SITEPACKAGES 1
30 RUN google-cloud-sdk/install.sh --usage-reporting=false --path-update=true --bash-completion=false --rc-path=/.bashrc --disable-installation-options
31 RUN google-cloud-sdk/bin/gcloud --quiet components update pkg-go pkg-python pkg-java preview alpha beta app
32 RUN google-cloud-sdk/bin/gcloud --quiet config set component_manager/disable_update_check true
34 ENV PATH /google-cloud-sdk/bin:$PATH
37 CMD ["/usr/local/bin/helpers/run.sh"]