Skip to content

Commit

Permalink
Merge pull request #1 from testainers/dev
Browse files Browse the repository at this point in the history
Version 0.0.1.
  • Loading branch information
edufolly authored Sep 19, 2024
2 parents f471bac + b8fd319 commit dcbc083
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 0 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: CI Build

on:
push:
branches: [ main ]

jobs:

build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: write
steps:
- name: Code Checkout
uses: actions/checkout@v4

- name: Get Version
run: |
echo "TAGS=latest" >> $GITHUB_ENV
SUFFIX=""
VERSION=$(grep 'version:' version.yaml | cut -c 10-)$SUFFIX
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "REPO=$GITHUB_REPOSITORY" >> $GITHUB_ENV
echo "OWNER=$GITHUB_REPOSITORY_OWNER" >> $GITHUB_ENV
- name: Check if version is used
run: |
URL=$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/releases/tags/${{ env.VERSION }}
echo "$URL"
CODE=$(curl -s -o /dev/null -w "%{http_code}" "$URL")
if [ "$CODE" != 404 ]; then
echo "Release '$VERSION' already exists. ($CODE)"
exit 1
fi
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ env.OWNER }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: Docker Build & Push
uses: docker/build-push-action@v6
with:
push: true
context: .
file: Dockerfile
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6,linux/386
tags: |
${{ env.REPO }}:${{ env.VERSION }}
${{ env.REPO }}:latest
- name: Creating GitHub Tag
uses: mathieudutour/github-tag-action@v6.2
with:
custom_tag: ${{ env.VERSION }}
tag_prefix: ''
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Create GitHub Release
uses: ncipollo/release-action@v1
with:
tag: ${{ env.VERSION }}
token: ${{ secrets.GITHUB_TOKEN }}
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM alpine:${ALPINE_VERSION:-3.20}

Check warning on line 1 in Dockerfile

View workflow job for this annotation

GitHub Actions / Build

FROM command must use declared ARGs

UndefinedArgInFrom: FROM argument 'ALPINE_VERSION' is not declared More info: https://docs.docker.com/go/dockerfile/rule/undefined-arg-in-from/

RUN apk add --update --no-cache busybox-extras envsubst

COPY entrypoint.sh /usr/local/bin/

EXPOSE 23

ENTRYPOINT ["entrypoint.sh"]
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ Run:

```shell
docker run -d --rm --name telnetd -p 2323:23 \
-e TELNET_USER=telnetuser \
-e TELNET_PWD=MySecret123! \
telnetd-container
```

Expand Down
18 changes: 18 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh

echo "ENTRYPOINT"

if [ -z "$TELNET_USER" ]; then
export TELNET_USER="test"
fi

if [ -z "$TELNET_PWD" ]; then
export TELNET_PWD="VeryDifficult246!"
fi

adduser -D "$TELNET_USER"

passwd "$TELNET_USER" -d "$TELNET_PWD"

### Start telnetd.
/usr/sbin/telnetd -F
1 change: 1 addition & 0 deletions version.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
version: 0.0.1

0 comments on commit dcbc083

Please sign in to comment.