From c9a48c02ad81d862a6cef6648460d48f2e76f7ae Mon Sep 17 00:00:00 2001 From: mtardy Date: Tue, 21 Jul 2020 20:40:49 +0200 Subject: [PATCH] Add Dockerfile and instructions to build with Docker --- .dockerignore | 3 +++ Dockerfile | 12 ++++++++++++ README.md | 12 ++++++++++++ 3 files changed, 27 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..a9bb210 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +.vscode/ +.calc.dSYM/ +.DS_Store \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c1544d8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM alpine:3.12 +# install gcc, make, libc and the bdw gc +RUN apk add --no-cache gcc make libc-dev gc-dev +# install leg +RUN wget -qO- https://www.piumarta.com/software/peg/peg-0.1.18.tar.gz | tar xz \ + && make -C /peg-0.1.18 leg >/dev/null 2>&1 \ + && mv /peg-0.1.18/leg /usr/bin/ \ + && rm -r peg-0.1.18 +# Add project files and compile +WORKDIR /javascrypt +COPY . . +RUN make \ No newline at end of file diff --git a/README.md b/README.md index 8d7b368..33323d6 100644 --- a/README.md +++ b/README.md @@ -18,11 +18,23 @@ $ brew install bdw-gc $ make ``` +## Docker + +The Docker image provides a ready to go environment to experiment with the project. Just build the image locally and run an interactive shell inside the container: +```bash +$ docker build . --tag mtardy/javascrypt +$ docker run -it mtardy/javascrypt +``` + ## Usage ```bash $ echo "a=2+3 a*2" | ./calc ``` +or +```bash +$ ./calc < file +``` ## Tests