Skip to content

Commit c4fc480

Browse files
committed
Added Dockerfile
1 parent 3dab20c commit c4fc480

File tree

3 files changed

+42
-2
lines changed

3 files changed

+42
-2
lines changed

CONTRIBUTING.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ cargo build
1010

1111
If you have any troubles building the project, please do make an issue!
1212

13-
## Testing
13+
## Testing without Docker
1414

1515
Install [zstd 1.5.2](https://github.com/facebook/zstd). For example, on Ubuntu you need the package `libzstd1`. For Windows, download the appropriate archive from the [releases](https://github.com/facebook/zstd/releases), extract it and add the extracted directory to your PATH.
1616

@@ -24,7 +24,7 @@ Install [.NET 6.0](https://dotnet.microsoft.com/download).
2424

2525
Install [check](https://libcheck.github.io/check/) (works with at least 0.14 and 0.15), [valgrind](https://valgrind.org/) and `libsubunit0` (or equivalent for your distribution).
2626

27-
Install [R](https://www.r-project.org/), [devtools](https://devtools.r-lib.org/) by running `install.packages("devtools")` in `R` and [tmc-r-tester](https://github.com/testmycode/tmc-rstudio) by running `devtools::install_github("testmycode/tmc-r-tester/tmcRtestrunner", build = FALSE)` in `R`. `devtools` has several dependencies that need to be installed. For Ubuntu, they can be installed with
27+
Install [R](https://www.r-project.org/), [devtools](https://devtools.r-lib.org/) by running `R -e 'install.packages("devtools")'` and [tmc-r-tester](https://github.com/testmycode/tmc-rstudio) by running `R -e 'devtools::install_github("testmycode/tmc-r-tester/tmcRtestrunner", build = FALSE)'`. `devtools` has several dependencies that need to be installed. For Ubuntu, they can be installed with
2828

2929
```bash
3030
sudo apt install libcurl-dev libxml2-dev libopenssl-dev gcc-c++ libharfbuzz-dev libfribidi-dev libfreetype6-dev libpng-dev libtiff5-dev libjpeg-dev
@@ -36,6 +36,14 @@ With the dependencies instaled, the tests can be run with
3636
cargo test
3737
```
3838

39+
## Testing with Docker
40+
```bash
41+
export DOCKER_BUILDKIT=1
42+
docker build . -f docker/Dockerfile -t tmc-langs-rust
43+
docker run --rm -it tmc-langs-rust bash
44+
cargo test
45+
```
46+
3947
## Formatting and linting
4048

4149
Use `cargo fmt` and `cargo clippy` for formatting and linting. All crates should have the clippy lints `print_stdout` and `print_stderr` set to deny to allow the CLI to have total control over stdout and stderr. The CLI has one function where writing to stdout is allowed.

docker/Dockerfile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
FROM rust:slim-buster
2+
3+
# C# https://learn.microsoft.com/en-us/dotnet/core/install/linux-debian
4+
RUN apt update \
5+
&& apt install -y wget \
6+
&& wget https://packages.microsoft.com/config/debian/11/packages-microsoft-prod.deb -O packages-microsoft-prod.deb \
7+
&& dpkg -i packages-microsoft-prod.deb \
8+
&& rm packages-microsoft-prod.deb
9+
10+
# install deps
11+
RUN apt update \
12+
&& apt install -y \
13+
# core libraries
14+
libzstd-dev \
15+
# languages
16+
npm \
17+
python3 \
18+
openjdk-11-jdk \
19+
dotnet-sdk-6.0 \
20+
check valgrind \
21+
r-base r-cran-devtools \
22+
# https://github.com/testmycode/tmc-r-tester/
23+
&& R -e 'devtools::install_github("testmycode/tmc-r-tester/tmcRtestrunner", build = FALSE)'
24+
25+
COPY . /build
26+
WORKDIR /build
27+
28+
RUN cargo check --tests --all-features

docker/Dockerfile.dockerignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
**/.git
2+
**/target
3+
**/node_modules
4+
**/*.node

0 commit comments

Comments
 (0)