Skip to content

Commit c95f1d5

Browse files
committed
Prepare docker image for labs
Signed-off-by: George Melikov <[email protected]>
1 parent 10814d7 commit c95f1d5

File tree

3 files changed

+59
-0
lines changed

3 files changed

+59
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Docker
2+
on:
3+
push:
4+
branches: [ master ]
5+
# Publish semver tags as releases.
6+
tags: [ 'v*.*.*' ]
7+
pull_request:
8+
branches: [ master ]
9+
env:
10+
REGISTRY: ghcr.io
11+
IMAGE_NAME: ${{ github.repository_owner }}/debian_lab
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
packages: write
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v2
21+
- name: Log into registry ${{ env.REGISTRY }}
22+
if: github.event_name != 'pull_request'
23+
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
24+
with:
25+
registry: ${{ env.REGISTRY }}
26+
username: ${{ github.actor }}
27+
password: ${{ secrets.GITHUB_TOKEN }}
28+
- name: Extract Docker metadata
29+
id: meta
30+
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
31+
with:
32+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
33+
- name: Build and push Docker image
34+
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
35+
with:
36+
context: ./tools/container/
37+
push: ${{ github.event_name != 'pull_request' }}
38+
tags: ${{ steps.meta.outputs.tags }}
39+
labels: ${{ steps.meta.outputs.labels }}

tools/container/Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM debian
2+
3+
WORKDIR /source
4+
RUN apt-get update \
5+
&& apt-get install --no-install-recommends -y iproute2 tcpdump \
6+
&& apt-get autoremove \
7+
&& apt-get clean \
8+
&& rm -rf /var/lib/apt/lists/*
9+
10+
COPY entrypoint.sh /entrypoint.sh
11+
RUN chmod +x /entrypoint.sh
12+
13+
ENTRYPOINT ["/entrypoint.sh"]

tools/container/entrypoint.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
# lab4
4+
echo aXAgcm91dGUgYWRkIGJsYWNraG9sZSAxNzIuMTguMC4xICMgIFdFJ1JFIEhJUklORyEgOikK | base64 -d | sh
5+
6+
7+
exec "$@"

0 commit comments

Comments
 (0)