Skip to content

Commit bb662d9

Browse files
feat: 🎉 Initial commit
Signed-off-by: Mario Vejlupek <[email protected]>
1 parent 53c3211 commit bb662d9

File tree

4 files changed

+91
-1
lines changed

4 files changed

+91
-1
lines changed

.github/workflows/build.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# NOTES:
2+
# 1. Create PAT with `read:packages` and `write:packages` see https://docs.github.com/en/free-pro-team@latest/packages/guides/migrating-to-github-container-registry-for-docker-images#authenticating-with-the-container-registry
3+
# 2. Create CR_PAT variable under Settings / Secrets
4+
5+
name: BUILD
6+
7+
on:
8+
push:
9+
# Publish `v1.2.3` tags as releases.
10+
tags:
11+
- v*
12+
13+
env:
14+
FETCHER_IMAGE_VERSION: ""
15+
BASE_IMAGE_VERSION: ""
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- uses: actions/checkout@v2
23+
24+
- name: Run build
25+
run: |
26+
IMAGE_NAME=ghcr.io/$(echo "${{ github.repository }}" | tr '[A-Z]' '[a-z]' )
27+
# Strip git ref prefix from version
28+
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
29+
docker build . \
30+
--build-arg FETCHER_IMAGE_VERSION=${FETCHER_IMAGE_VERSION} \
31+
--build-arg BASE_IMAGE_VERSION=${BASE_IMAGE_VERSION} \
32+
--file Dockerfile --tag $IMAGE_NAME:$VERSION
33+
34+
- name: Log into GitHub Container Registry
35+
run: echo "${{ secrets.CR_PAT }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
36+
37+
- name: Push image to GitHub Container Registry
38+
run: |
39+
IMAGE_NAME=ghcr.io/$(echo "${{ github.repository }}" | tr '[A-Z]' '[a-z]' )
40+
# Strip git ref prefix from version
41+
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
42+
echo IMAGE_NAME=$IMAGE_NAME
43+
echo VERSION=$VERSION
44+
docker push $IMAGE_NAME:$VERSION
45+
# Push latest as well for caching purposes
46+
docker tag $IMAGE_NAME:$VERSION $IMAGE_NAME:latest
47+
docker push $IMAGE_NAME:latest

.github/workflows/test.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# TODO:
2+
# 1. Create PAT with `read:packages` and `write:packages` see https://docs.github.com/en/free-pro-team@latest/packages/guides/migrating-to-github-container-registry-for-docker-images#authenticating-with-the-container-registry
3+
# 2. Create CR_PAT variable under Settings / Secrets
4+
5+
name: TEST
6+
7+
on:
8+
push:
9+
branches:
10+
- main
11+
12+
env:
13+
FETCHER_IMAGE_VERSION: ""
14+
BASE_IMAGE_VERSION: ""
15+
16+
# NOTE: DO NOT CHANGE THIS THIS IS TMP IMAGE NAME
17+
IMAGE_NAME: image
18+
19+
jobs:
20+
test:
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- uses: actions/checkout@v2
25+
26+
- name: Run tests
27+
run: |
28+
docker build . \
29+
--build-arg FETCHER_IMAGE_VERSION=${FETCHER_IMAGE_VERSION} \
30+
--build-arg BASE_IMAGE_VERSION=${BASE_IMAGE_VERSION} \
31+
--file Dockerfile --tag $IMAGE_NAME

Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# BUILDER
2+
FROM bitnami/kubectl:1.22.8-debian-10-r23 as FETCHER
3+
4+
# IMAGE
5+
FROM amazon/aws-cli:2.5.4
6+
7+
LABEL org.opencontainers.image.source https://github.com/Container-Driven-Development/aws-kubectl
8+
9+
ENTRYPOINT ["/usr/local/sbin/kubectl"]
10+
11+
COPY --from=FETCHER /opt/bitnami/kubectl/bin/kubectl /usr/local/sbin/kubectl

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
# aws-kubectl
1+
# AWS with kubectl
2+
23
aws cli kubectl

0 commit comments

Comments
 (0)