Skip to content

Commit

Permalink
work on ci cd
Browse files Browse the repository at this point in the history
  • Loading branch information
marniks7 committed Aug 30, 2022
1 parent 604f1ed commit fe21983
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 18 deletions.
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
71 changes: 71 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: ci

on:
push:
branches:
- 'main'

jobs:
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
# list of Docker images to use as base name for tags
images: |
${{ github.repository }}
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v3
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Docker Hub Description
uses: peter-evans/dockerhub-description@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: ${{ github.repository }}
- name: test
uses: addnab/docker-run-action@v3
with:
image: ${{ github.repository }}:latest
run: |
set -e
kubectl version --client
k version
docker version
yq --version
jq --version
kind version
k3d version
tkn version
kpt version
helm version
kubectl krew version
kubectl tkn version
# kubectl ns --help
# kubectl ctx --help
File renamed without changes.
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@

#-------------main--------------
build-env:
docker buildx build --platform linux/amd64 -t marniks7/dev-env -f DockerfileBuildx --progress plain --load .
docker buildx build --platform linux/amd64 -t marniks7/env --progress plain --load .
run-env:
docker run --network host --add-host=host.docker.internal:host-gateway -it \
-v ${PWD}:${PWD} \
touch .bash_history && docker run --network host --add-host=host.docker.internal:host-gateway -it \
-v ${PWD}:${PWD} --workdir ${PWD} \
--mount type=bind,source=${PWD}/.bash_history,target=/root/.bash_history \
-v /var/run/docker.sock:/var/run/docker.sock --workdir ${PWD} \
--user=$(id -u):$(id -g) \
marniks7/dev-env bash -c './init.sh && bash'
-v /var/run/docker.sock:/var/run/docker.sock \
marniks7/env bash -c './init.sh && bash'
34 changes: 22 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,38 @@ List of Software Installed:
## Run

1. Go to the directory where you are going to use it
2. `touch .bash_history`
3. Run:
(for better experience copy this to `Makefile`)

2. Run simple
```
docker run --network host --add-host=host.docker.internal:host-gateway -it \
-v ${PWD}:${PWD} \
-v ${PWD}:${PWD} --workdir ${PWD} \
-v /var/run/docker.sock:/var/run/docker.sock \
marniks7/env bash
```

## Preserving bash history
```
touch .bash_history && docker run --network host --add-host=host.docker.internal:host-gateway -it \
-v ${PWD}:${PWD} --workdir ${PWD} \
--mount type=bind,source=${PWD}/.bash_history,target=/root/.bash_history \
-v /var/run/docker.sock:/var/run/docker.sock --workdir ${PWD} \
--user=$(id -u):$(id -g) \
marniks7/dev-env
-v /var/run/docker.sock:/var/run/docker.sock \
marniks7/env bash
```

4. To run with init script add to the end
` bash -c './init.sh && bash'`
## Run with local script
To run with init script, like [init.sh](init.sh), add to the end of the run command ` bash -c './init.sh && bash'`, result:
```
docker run --network host --add-host=host.docker.internal:host-gateway -it \
-v ${PWD}:${PWD} --workdir ${PWD} \
-v /var/run/docker.sock:/var/run/docker.sock \
marniks7/env bash -c './init.sh && bash'
```

## Absent Features

1. [ ] No programming languages installed so far (e.g. python, go, js, java)
* And may not be installed there at all because it is usually used on local system
2. [ ] Manual versions update (e.g. no bot connected)
3. [ ] Impossible to reuse [DockerfileBuildx](DockerfileBuildx) scripts for local system.
3. [ ] Impossible to reuse [Dockerfile](Dockerfile) scripts for local system.
See [Local System Analyze](docs/local-system.md)
4. [ ] SElinux docs
5. [ ] WSL docs
Expand All @@ -60,7 +70,7 @@ I didn't try (because of the image size, 20GB+ compressed, 60GB extracted), but

## Thoughts

That [Dockerfile](DockerfileBuildx) looks like too much manual work, so maybe there are other managed distributions
That [Dockerfile](Dockerfile) looks like too much manual work, so maybe there are other managed distributions
which
provides all the packages. Based on fast check on [packages](https://pkgs.org/) it doesn't look like that.
Some other options considered: [other base images](other) doesn't contain everything either

0 comments on commit fe21983

Please sign in to comment.