Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerfile and github action to build #73

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: CI

on:
push:
pull_request:

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]

- uses: docker/[email protected]
- uses: docker/[email protected]

- name: Login to GitHub
if: github.ref == 'refs/heads/master'
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- id: docker_meta
uses: docker/[email protected]
with:
images: |
ghcr.io/${{ github.repository }}
flavor: |
latest=true
tags: |
type=sha,format=long
type=edge,branch=$repo.default_branch

- name: build+push
uses: docker/build-push-action@c56af957549030174b10d6867f20e78cfd7debc5 # tag=v3.2.0
with:
platforms: linux/amd64,linux/arm64
push: ${{ github.ref == 'refs/heads/master' }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM alpine:latest as build

ENV JTCL_VERSION 2.8.0
ENV JTCL_IRULE_VERSION 0.9

RUN \
wget -q -O - https://github.com/jtcl-project/jtcl/releases/download/${JTCL_VERSION}-release/jtcl-${JTCL_VERSION}-bin.zip \
| busybox unzip -d /opt - && \
mv -v /opt/jtcl-${JTCL_VERSION} /opt/jtcl

ADD https://github.com/landro/jtcl-irule/releases/download/v${JTCL_IRULE_VERSION}/jtcl-irule-${JTCL_IRULE_VERSION}.jar /opt/jtcl-irule-${JTCL_IRULE_VERSION}.jar

RUN sed -i -e "s/export CLASSPATH/export CLASSPATH=\/opt\/jtcl-irule-${JTCL_IRULE_VERSION}.jar:\$CLASSPATH/g" /opt/jtcl/jtcl

COPY . /opt/TesTcl
RUN chmod -R 755 /opt/TesTcl/tests.sh /opt/jtcl/jtcl

FROM openjdk:slim

COPY --from=build /opt/ /opt/

ENV TCLLIBPATH=/opt/TesTcl
ENV PATH=/opt/jtcl:/opt/test:/app:$PATH

WORKDIR /app

CMD ["/opt/TesTcl/tests.sh", "jtcl"]
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,46 @@ it "should replace existing Vary http response headers with Accept-Encoding valu
}
```

#### Jumpstart with Docker and use in CI

Assuming you have a directory structure that looks like:
```text
my-repo/
├─ test/
│ ├─ test_one.tcl
│ ├─ test_two.tcl
│ ├─ test_three.tcl
│ ├─ test_four.tcl
├─ one.tcl
├─ two.tcl
├─ three.tcl
```

You can very simply run:
<!-- NOTE TO MAINTAINER: please update to the official docker image address if you merge-->
```bash
docker run -it --rm -v ${PWD}:/app ghcr.io/chrisns/testcl
```

In CI you can simply use something like this in GitHub Actions
```yaml
# example: https://github.com/chrisns/bigip-irule-demo/blob/main/.github/workflows/ci.yaml

# .github/workflows/ci.yaml
name: CI

on:
push:
pull_request:

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: docker://ghcr.io/chrisns/testcl
```

#### Installing JTcl including jtcl-irule extensions

##### Install JTcl
Expand Down