From 6c31e52b239736d0b118a3a5617d643b478c273f Mon Sep 17 00:00:00 2001 From: Jason Williams Date: Sat, 18 Aug 2018 11:44:12 +0100 Subject: [PATCH] adding Dockerfile for rust --- .editorConfig | 5 +++++ .vscode/launch.json | 8 ++++---- Dockerfile | 21 +++++++++++++++++++++ Makefile | 14 ++++++++++++++ src/bin/bin.rs | 1 + 5 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 .editorConfig create mode 100644 Dockerfile create mode 100644 Makefile diff --git a/.editorConfig b/.editorConfig new file mode 100644 index 0000000000..f8296da124 --- /dev/null +++ b/.editorConfig @@ -0,0 +1,5 @@ +root = true + +[{Makefile,**.mk}] +# Use tabs for indentation (Makefiles require tabs) +indent_style = tab diff --git a/.vscode/launch.json b/.vscode/launch.json index 3f905be358..0f6c2f58ab 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -8,13 +8,13 @@ "type": "lldb", "request": "launch", "name": "Launch", - "program": "${workspaceFolder}/target/debug/bin", "args": [], - "cwd": "${workspaceFolder}", + "program": "./target/debug/bin", + "cwd": "${workspaceRoot}", + "stopOnEntry": false, "sourceLanguages": [ "rust" - ], - "stopOnEntry": true + ] }, { "name": "(Windows) Launch", diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000..6ca44e765c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +FROM rust:latest + +WORKDIR /usr/src/myapp +COPY . . + +# LLDB Server +EXPOSE 9228 + +RUN apt-get update \ + apt-get upgrade \ + apt-get install -y software-properties-common + +# https://askubuntu.com/questions/787383/how-to-install-llvm-3-9 +# http://apt.llvm.org/ +RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - +RUN apt-add-repository "deb http://apt.llvm.org/stretch/ llvm-toolchain-stretch-6.0 main" +RUN apt-get update +RUN apt-get install clang-6.0 lldb-6.0 + + +CMD ["/bin/bash"] \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000..0f07430b64 --- /dev/null +++ b/Makefile @@ -0,0 +1,14 @@ +docker-build: + docker build --tag boa . + +docker-container: + docker create --tty --interactive \ + --name boa \ + --hostname boa \ + --volume ${PWD}/:/usr/src/myapp \ + --publish 9228:9228 \ + boa + +docker-clean: + docker rm boa || echo "no container" + docker rmi boa || echo "no image" \ No newline at end of file diff --git a/src/bin/bin.rs b/src/bin/bin.rs index fb24e0e8a1..fa84b5c8a3 100644 --- a/src/bin/bin.rs +++ b/src/bin/bin.rs @@ -7,4 +7,5 @@ pub fn main() { let mut lexer = Lexer::new(&buffer); lexer.lex().expect("finished"); println!("{:?}", lexer.tokens); + println!("Hello World"); }