Skip to content

Commit 9851ce6

Browse files
committed
init
0 parents  commit 9851ce6

File tree

6 files changed

+168
-0
lines changed

6 files changed

+168
-0
lines changed

.dockerignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.github
2+
README.md
3+
LICENSE.md
4+
Dockerfile
5+
.editorconfig
6+
.gitignore
7+
testing.sh

.editorconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_size = 2
7+
indent_style = space
8+
insert_final_newline = true
9+
max_line_length = 200
10+
tab_width = 2

.github/workflows/container.yml

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
name: Container Image
2+
on:
3+
push:
4+
branches:
5+
- 'main'
6+
tags:
7+
- '**'
8+
9+
env:
10+
debian_version: bullseye
11+
12+
jobs:
13+
build:
14+
name: Build container image and push it to registry
15+
runs-on: ubuntu-latest
16+
permissions:
17+
id-token: write
18+
contents: read
19+
packages: write
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v3
23+
24+
- name: Login to Docker Hub
25+
uses: docker/login-action@v2
26+
with:
27+
username: ${{ secrets.DOCKERHUB_USERNAME }}
28+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
29+
30+
- name: Login to GitHub Container Registry
31+
uses: docker/login-action@v2
32+
with:
33+
registry: ghcr.io
34+
username: ${{ github.actor }}
35+
password: ${{ secrets.GITHUB_TOKEN }}
36+
37+
- name: Configure AWS credentials
38+
uses: aws-actions/configure-aws-credentials@v1
39+
with:
40+
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
41+
aws-region: us-east-1
42+
43+
- name: Login to Amazon ECR Public
44+
id: login-ecr-public
45+
uses: aws-actions/amazon-ecr-login@v1
46+
with:
47+
registry-type: public
48+
49+
- name: Parse version
50+
id: get-version
51+
uses: battila7/get-version-action@v2
52+
53+
- name: Set up QEMU
54+
uses: docker/setup-qemu-action@v2
55+
56+
- name: Set up Docker Buildx
57+
uses: docker/setup-buildx-action@v2
58+
59+
- name: Build and push - testing
60+
uses: docker/build-push-action@v3
61+
if: ${{ !steps.get-version.outputs.is-semver }}
62+
with:
63+
context: .
64+
file: ./Dockerfile
65+
platforms: linux/amd64,linux/arm64
66+
push: true
67+
build-args: |
68+
DEBIAN_VERSION=${{ env.debian_version }}
69+
tags: |
70+
cookielab/slim:${{ github.ref_name }}
71+
public.ecr.aws/cookielab/slim:${{ github.ref_name }}
72+
ghcr.io/${{ github.repository }}:${{ github.ref_name }}
73+
74+
- name: Build and push - pre-release
75+
uses: docker/build-push-action@v3
76+
if: ${{ steps.get-version.outputs.is-semver && steps.get-version.outputs.prerelease != '' }}
77+
with:
78+
context: .
79+
file: ./Dockerfile
80+
platforms: linux/amd64,linux/arm64
81+
push: true
82+
build-args: |
83+
DEBIAN_VERSION=${{ steps.get-version.outputs.major }}.${{ steps.get-version.outputs.minor }}
84+
tags: |
85+
cookielab/slim:${{ steps.get-version.outputs.version-without-v }}
86+
public.ecr.aws/cookielab/slim:${{ steps.get-version.outputs.version-without-v }}
87+
ghcr.io/${{ github.repository }}:${{ steps.get-version.outputs.version-without-v }}
88+
89+
- name: Build and push - stable
90+
uses: docker/build-push-action@v3
91+
if: ${{ steps.get-version.outputs.is-semver && steps.get-version.outputs.prerelease == '' }}
92+
with:
93+
context: .
94+
file: ./Dockerfile
95+
platforms: linux/amd64,linux/arm64
96+
push: true
97+
build-args: |
98+
DEBIAN_VERSION=${{ steps.get-version.outputs.major }}.${{ steps.get-version.outputs.minor }}
99+
tags: |
100+
cookielab/slim:${{ steps.get-version.outputs.version-without-v }}
101+
cookielab/slim:${{ steps.get-version.outputs.major }}.${{ steps.get-version.outputs.minor }}.${{ steps.get-version.outputs.patch }}
102+
cookielab/slim:${{ steps.get-version.outputs.major }}.${{ steps.get-version.outputs.minor }}
103+
cookielab/slim:${{ steps.get-version.outputs.major }}
104+
cookielab/slim:${{ env.debian_version }}
105+
public.ecr.aws/cookielab/slim:${{ steps.get-version.outputs.version-without-v }}
106+
public.ecr.aws/cookielab/slim:${{ steps.get-version.outputs.major }}.${{ steps.get-version.outputs.minor }}.${{ steps.get-version.outputs.patch }}
107+
public.ecr.aws/cookielab/slim:${{ steps.get-version.outputs.major }}.${{ steps.get-version.outputs.minor }}
108+
public.ecr.aws/cookielab/slim:${{ steps.get-version.outputs.major }}
109+
public.ecr.aws/cookielab/slim:${{ env.debian_version }}
110+
ghcr.io/${{ github.repository }}:${{ steps.get-version.outputs.version-without-v }}
111+
ghcr.io/${{ github.repository }}:${{ steps.get-version.outputs.major }}.${{ steps.get-version.outputs.minor }}.${{ steps.get-version.outputs.patch }}
112+
ghcr.io/${{ github.repository }}:${{ steps.get-version.outputs.major }}.${{ steps.get-version.outputs.minor }}
113+
ghcr.io/${{ github.repository }}:${{ steps.get-version.outputs.major }}
114+
ghcr.io/${{ github.repository }}:${{ env.debian_version }}

Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
ARG DEBIAN_VERSION
2+
FROM debian:${DEBIAN_VERSION}-slim
3+
4+
RUN useradd -m -d /container -s /bin/bash -u 1987 container
5+
6+
# container user
7+
USER 1987
8+
WORKDIR /container
9+
10+
ONBUILD USER root

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# The MIT License (MIT)
2+
3+
Copyright © 2022 Cookielab s.r.o.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# cookielab/slim
2+
3+
This container image is base image for all slim variants of cookielab images.
4+
5+
On top of original slim image it contains user `container` with _uid_ `1987`.
6+
And work dir is set to `/container` with is also home dir of `container` user.

0 commit comments

Comments
 (0)