Skip to content

Commit

Permalink
Add docker container to generate parsers and languages (#154)
Browse files Browse the repository at this point in the history
The cucumber/build container is huge. Most people only need it to run
Berp. So, instead of downloading and maintaining a multi-gigabyte
container, lets use a lean one with exactly one purpose.
  • Loading branch information
ehuelsmann authored Aug 2, 2024
1 parent 47ce60a commit 7109f8f
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 16 deletions.
40 changes: 24 additions & 16 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,38 +24,46 @@ localisations and generating the parser is done separately from building each pr

## Generating parsers

Prerequisites:
*Either* start a docker container

```shell
docker build --tag berp-env .
docker run --rm --interactive --tty --volume ".:/app" berp-env
```

*Or* install on your system

* .NET 5.0 (to run `berp` to generate parsers)
* `berp` (install with `dotnet tool update Berp --version 1.3.0 --tool-path /usr/bin` )
* `make`
* `jq` (>= 1.4 for `--sort-keys` option)
* `diff`
* `git`

With all this installed use Make:
With either of these done run:

```
make generate
```shell
make clean-generate
make generate
```

## Adding or updating an i18n language

Prerequisites:
1) Edit `gherkin-langauges.json`.

* `make`
* `jq` (>= 1.4 for `--sort-keys` option)
* `git`
2) Distribute the changes to the different parser implementations:

1) Edit `gherkin-langauges.json`.
*Either* start a docker container. See [Generating Parsers](#generating-parsers)

2) Distribute the changes to the different parser implementations, this requires `make`, `jq`, `diff`, but no compiler/interpreters:
*Or* install on your system

```
make clean-gherkin-languages
make copy-gherkin-languages
```
* `make`
* `jq` (>= 1.4 for `--sort-keys` option)

Then with either of these done run

```shell
make clean-gherkin-languages
make copy-gherkin-languages
```

3) Make a pull request with the changed files.

Expand Down
25 changes: 25 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Builds a docker image used for building most projects in this repo. It's
# used both by contributors and CI.
#
FROM mcr.microsoft.com/dotnet/sdk:6.0

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update \
&& apt-get install --assume-yes \
make \
jq


WORKDIR /app

## Trigger first run experience by running arbitrary cmd to populate local package cache
RUN dotnet --list-sdks

# Install Berp (dotnet tool installs are user-global; not system global)
RUN dotnet tool install --global Berp --version 1.4.0 \
&& echo 'export PATH="$PATH:/root/.dotnet/tools"' >> ~/.bashrc

WORKDIR /app

CMD ["/bin/bash"]

0 comments on commit 7109f8f

Please sign in to comment.