docker: Add Dockerfile and docker wrapper script.

This commit is contained in:
Andrew Hamilton 2020-01-10 12:36:47 +10:00
parent b696c65f4c
commit a6935e142c
2 changed files with 41 additions and 0 deletions

15
Dockerfile Normal file
View file

@ -0,0 +1,15 @@
# Copyright (C) 2020 Andrew Hamilton. All rights reserved.
# Licensed under the Artistic License 2.0.
FROM ubuntu:eoan
RUN apt update && apt install -y git sudo
RUN git clone https://github.com/ahamilton/eris
RUN cd eris && git checkout b696c65f4cec1ae53a3d49352dd1380a6a8f9510
RUN rm -rf eris/.git
RUN DEBIAN_FRONTEND=noninteractive apt install -y tzdata
RUN cd eris && ./install-dependencies
RUN python3.7 -m pip install ./eris
ENTRYPOINT ["eris"]

26
eris-docker Executable file
View file

@ -0,0 +1,26 @@
#!/bin/bash
# Copyright (C) 2020 Andrew Hamilton. All rights reserved.
# Licensed under the Artistic License 2.0.
set -e
DOCKER_IMAGE=eris
ARGS=( $(getopt -u -o hw:e:t:c: --long help,workers:,editor:,theme:,compression: -- "$@") )
if [ "${ARGS[-1]}" == "--" ]; then
OPTION_ARGS="${ARGS[@]:0:${#ARGS[@]}-1}" # ARGS[:-1]
DOCKER_ARGS="$DOCKER_IMAGE $OPTION_ARGS"
elif [ "${ARGS[-2]}" == "--" ]; then
OPTION_ARGS="${ARGS[@]:0:${#ARGS[@]}-2}" # ARGS[:-2]
REAL_PATH=$(realpath "${ARGS[-1]}")
PROJECT=$(basename "$REAL_PATH")
DOCKER_ARGS="-v $REAL_PATH:/tmp/$PROJECT $DOCKER_IMAGE $OPTION_ARGS /tmp/$PROJECT"
else
echo "Usage:
eris [options] <directory>
eris -h | --help"
exit 1
fi
exec docker run -v /etc/passwd:/etc/passwd -u ${UID}:$(id -g) -it --rm $DOCKER_ARGS