Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
Vrtak-CZ committed Dec 23, 2022
0 parents commit 9851ce6
Show file tree
Hide file tree
Showing 6 changed files with 168 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.github
README.md
LICENSE.md
Dockerfile
.editorconfig
.gitignore
testing.sh
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
max_line_length = 200
tab_width = 2
114 changes: 114 additions & 0 deletions .github/workflows/container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: Container Image
on:
push:
branches:
- 'main'
tags:
- '**'

env:
debian_version: bullseye

jobs:
build:
name: Build container image and push it to registry
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
aws-region: us-east-1

- name: Login to Amazon ECR Public
id: login-ecr-public
uses: aws-actions/amazon-ecr-login@v1
with:
registry-type: public

- name: Parse version
id: get-version
uses: battila7/get-version-action@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

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

- name: Build and push - testing
uses: docker/build-push-action@v3
if: ${{ !steps.get-version.outputs.is-semver }}
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
build-args: |
DEBIAN_VERSION=${{ env.debian_version }}
tags: |
cookielab/slim:${{ github.ref_name }}
public.ecr.aws/cookielab/slim:${{ github.ref_name }}
ghcr.io/${{ github.repository }}:${{ github.ref_name }}
- name: Build and push - pre-release
uses: docker/build-push-action@v3
if: ${{ steps.get-version.outputs.is-semver && steps.get-version.outputs.prerelease != '' }}
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
build-args: |
DEBIAN_VERSION=${{ steps.get-version.outputs.major }}.${{ steps.get-version.outputs.minor }}
tags: |
cookielab/slim:${{ steps.get-version.outputs.version-without-v }}
public.ecr.aws/cookielab/slim:${{ steps.get-version.outputs.version-without-v }}
ghcr.io/${{ github.repository }}:${{ steps.get-version.outputs.version-without-v }}
- name: Build and push - stable
uses: docker/build-push-action@v3
if: ${{ steps.get-version.outputs.is-semver && steps.get-version.outputs.prerelease == '' }}
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
build-args: |
DEBIAN_VERSION=${{ steps.get-version.outputs.major }}.${{ steps.get-version.outputs.minor }}
tags: |
cookielab/slim:${{ steps.get-version.outputs.version-without-v }}
cookielab/slim:${{ steps.get-version.outputs.major }}.${{ steps.get-version.outputs.minor }}.${{ steps.get-version.outputs.patch }}
cookielab/slim:${{ steps.get-version.outputs.major }}.${{ steps.get-version.outputs.minor }}
cookielab/slim:${{ steps.get-version.outputs.major }}
cookielab/slim:${{ env.debian_version }}
public.ecr.aws/cookielab/slim:${{ steps.get-version.outputs.version-without-v }}
public.ecr.aws/cookielab/slim:${{ steps.get-version.outputs.major }}.${{ steps.get-version.outputs.minor }}.${{ steps.get-version.outputs.patch }}
public.ecr.aws/cookielab/slim:${{ steps.get-version.outputs.major }}.${{ steps.get-version.outputs.minor }}
public.ecr.aws/cookielab/slim:${{ steps.get-version.outputs.major }}
public.ecr.aws/cookielab/slim:${{ env.debian_version }}
ghcr.io/${{ github.repository }}:${{ steps.get-version.outputs.version-without-v }}
ghcr.io/${{ github.repository }}:${{ steps.get-version.outputs.major }}.${{ steps.get-version.outputs.minor }}.${{ steps.get-version.outputs.patch }}
ghcr.io/${{ github.repository }}:${{ steps.get-version.outputs.major }}.${{ steps.get-version.outputs.minor }}
ghcr.io/${{ github.repository }}:${{ steps.get-version.outputs.major }}
ghcr.io/${{ github.repository }}:${{ env.debian_version }}
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
ARG DEBIAN_VERSION
FROM debian:${DEBIAN_VERSION}-slim

RUN useradd -m -d /container -s /bin/bash -u 1987 container

# container user
USER 1987
WORKDIR /container

ONBUILD USER root
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# The MIT License (MIT)

Copyright © 2022 Cookielab s.r.o.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# cookielab/slim

This container image is base image for all slim variants of cookielab images.

On top of original slim image it contains user `container` with _uid_ `1987`.
And work dir is set to `/container` with is also home dir of `container` user.

0 comments on commit 9851ce6

Please sign in to comment.