From ce6cd3aa785cfb2eb219762d93e922d10c853266 Mon Sep 17 00:00:00 2001 From: Aivaras Baranauskas <5412767+aivarasbaranauskas@users.noreply.github.com> Date: Wed, 13 Sep 2023 15:23:07 +0300 Subject: [PATCH] shell environment --- .github/workflows/test-sh.yml | 20 ++++++++++++++++++++ Dockerfile | 9 +++++++++ README.md | 8 ++++++++ run-sh.sh | 3 +++ sh/main.sh | 1 + 5 files changed, 41 insertions(+) create mode 100644 .github/workflows/test-sh.yml create mode 100755 run-sh.sh create mode 100755 sh/main.sh diff --git a/.github/workflows/test-sh.yml b/.github/workflows/test-sh.yml new file mode 100644 index 0000000..37a7d0d --- /dev/null +++ b/.github/workflows/test-sh.yml @@ -0,0 +1,20 @@ +name: Run tests + +on: + pull_request: + paths: + - 'sh/**' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: "1.21" + + - name: Test + run: LANGUAGE=sh go test -v ./... -count 1 diff --git a/Dockerfile b/Dockerfile index 4df91b0..1226baf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -42,3 +42,12 @@ VOLUME /opt/cs WORKDIR /opt ENV LANGUAGE=cs CMD ["/opt/challenge", "-test.v"] + +FROM ubuntu:22.04 as sh +COPY --from=builder /app/challenge /opt/challenge +COPY --from=builder /app/tests /opt/tests +COPY --from=builder /app/run-sh.sh /opt/run-sh.sh +VOLUME /opt/sh +WORKDIR /opt +ENV LANGUAGE=sh +CMD ["/opt/challenge", "-test.v"] diff --git a/README.md b/README.md index 45e5b04..22adb6b 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,13 @@ docker run -v ${PWD}/cs:/opt/cs aurelijusbanelis/challenge:cs ``` Where your code is in `cs` folder with `cs/Program.cs` file. +### Shell + +```shell +docker run -v ${PWD}/sh:/opt/sh aurelijusbanelis/challenge:sh +``` +Where your code is in `sh` folder with `sh/main.sh` file. + ### Not trusting docker? @@ -53,6 +60,7 @@ docker build --target go . -t aurelijusbanelis/challenge:go docker build --target php . -t aurelijusbanelis/challenge:php docker build --target js . -t aurelijusbanelis/challenge:js docker build --target cs . -t aurelijusbanelis/challenge:cs +docker build --target sh . -t aurelijusbanelis/challenge:sh ``` See [Dockerfile](Dockerfile) and [GitHub Actions](.github/workflows/infrastructure.yml) for details. diff --git a/run-sh.sh b/run-sh.sh new file mode 100755 index 0000000..5af7507 --- /dev/null +++ b/run-sh.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +./sh/main.sh \ No newline at end of file diff --git a/sh/main.sh b/sh/main.sh new file mode 100755 index 0000000..1a24852 --- /dev/null +++ b/sh/main.sh @@ -0,0 +1 @@ +#!/bin/sh