Index: docker-compose.shell.yml =================================================================== --- /dev/null +++ docker-compose.shell.yml @@ -0,0 +1,14 @@ +# 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/. + +# This compose file is meant to be used via 'invoke shell'. +# +# Runs a development shell with 'arc' installed. + +version: '2' +services: + shell: + build: + context: ./docker/shell + dockerfile: ./Dockerfile Index: docker/shell/Dockerfile =================================================================== --- /dev/null +++ docker/shell/Dockerfile @@ -0,0 +1,29 @@ +# 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/. + +FROM alpine:3.3 + +# Build/install dependencies +RUN apk --no-cache add ca-certificates curl bash php-cli php-curl php-json git + +# add a non-privileged user +RUN addgroup -g 1000 phab && adduser -D -u 1000 -G phab -s /bin/bash phab + +WORKDIR /home/phab + +# Install Arcanist +RUN mkdir -p phabricator \ + && cd phabricator \ + && git clone https://github.com/phacility/libphutil.git \ + && git clone https://github.com/phacility/arcanist.git + +COPY arcrc .arcrc +COPY gitconfig .gitconfig +RUN chmod 600 .arcrc \ + && echo "export PATH=/home/phab/phabricator/arcanist/bin:\$PATH" >> .bash_profile \ + && echo "export EDITOR=vi" >> .bash_profile \ + && chown -R phab:phab /home/phab + +USER phab +CMD ["/bin/bash"] Index: docker/shell/arcrc =================================================================== --- /dev/null +++ docker/shell/arcrc @@ -0,0 +1,10 @@ +{ + "config": { + "phabricator.uri": "http://phabricator.test" + }, + "hosts": { + "http://phabricator.test/api/": { + "token": "XXX" + } + } +} Index: docker/shell/gitconfig =================================================================== --- /dev/null +++ docker/shell/gitconfig @@ -0,0 +1,3 @@ +[user] + email = you@example.com + name = Your Name Index: tasks.py =================================================================== --- /dev/null +++ tasks.py @@ -0,0 +1,16 @@ +# 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/. + +from invoke import task +from accepted-older + +@task +def shell(c): + """Run a shell with 'arc' installed.""" + c.run('docker-compose' + ' -f docker-compose.yml' + ' -f docker-compose.shell.yml' + ' run shell', + pty=True + )