Skip to content

Commit 25461aa

Browse files
authored
feat(test-base): add docker image to use as base for testing (#16)
Signed-off-by: Charly Molter <[email protected]>
1 parent 5a2954d commit 25461aa

File tree

2 files changed

+71
-0
lines changed

2 files changed

+71
-0
lines changed

.github/workflows/build-docker.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Controls when the workflow will run
2+
on:
3+
pull_request:
4+
branches:
5+
- 'main'
6+
7+
permissions:
8+
packages: write
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v3
15+
- uses: docker/setup-qemu-action@v2
16+
- id: buildx
17+
uses:
18+
docker/setup-buildx-action@v2
19+
- if: github.event_name != 'pull_request'
20+
uses: docker/login-action@v2
21+
with:
22+
registry: ghcr.io
23+
username: ${{ github.repository_owner }}
24+
password: ${{ secrets.GITHUB_TOKEN }}
25+
- id: meta
26+
uses: docker/metadata-action@v3
27+
with:
28+
# list of Docker images to use as base name for tags
29+
images: ghcr.io/${{github.repository_owner}}/ubuntu-netools
30+
# Docker tags based on the following events/attributes
31+
tags: |
32+
type=ref,event=pr
33+
type=sha
34+
- uses: docker/build-push-action@v4
35+
with:
36+
context: docker
37+
platforms: linux/amd64,linux/arm64
38+
push: ${{ github.event_name != 'pull_request' }}
39+
tags: ${{ steps.meta.outputs.tags }}
40+
file: docker/ubuntu-netools.Dockerfile

docker/ubuntu-netools.Dockerfile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
FROM ubuntu:22.04
2+
3+
RUN apt update \
4+
&& apt dist-upgrade -y \
5+
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
6+
curl \
7+
dnsutils \
8+
iproute2 \
9+
iptables \
10+
ncat \
11+
net-tools \
12+
openssh-server \
13+
rsync \
14+
strace \
15+
tcpdump \
16+
telnet \
17+
tmux \
18+
tzdata \
19+
vim \
20+
&& apt clean \
21+
&& rm -rf /var/lib/apt/lists/*
22+
23+
RUN ssh-keygen -A \
24+
&& sed -i s/#PermitRootLogin.*/PermitRootLogin\ yes/ /etc/ssh/sshd_config \
25+
&& sed -i s/#PermitEmptyPasswords.*/PermitEmptyPasswords\ yes/ /etc/ssh/sshd_config \
26+
&& mkdir /var/run/sshd \
27+
&& passwd -d root \
28+
&& chmod a+rwx /root
29+
30+
# do not detach (-D), log to stderr (-e)
31+
CMD ["/usr/sbin/sshd", "-D", "-e"]

0 commit comments

Comments
 (0)