Skip to content

Commit e54385b

Browse files
committed
User containers
Signed-off-by: Joel Winarske <joel.winarske@gmail.com>
1 parent 53cf2cd commit e54385b

File tree

6 files changed

+234
-0
lines changed

6 files changed

+234
-0
lines changed

.github/workflows/ubuntu20-user.yml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: ubuntu20-user-docker-build
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
tags:
8+
- 'v*'
9+
pull_request:
10+
branches:
11+
- 'main'
12+
13+
env:
14+
REGISTRY_USER: ${{ github.actor }}
15+
REGISTRY_PASSWORD: ${{ github.token }}
16+
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }}
17+
18+
jobs:
19+
20+
ubuntu-20-user:
21+
runs-on: ubuntu-latest
22+
steps:
23+
24+
- name: Log in to ghcr.io
25+
uses: redhat-actions/podman-login@v1.6
26+
with:
27+
username: ${{ env.REGISTRY_USER }}
28+
password: ${{ env.REGISTRY_PASSWORD }}
29+
registry: ${{ env.IMAGE_REGISTRY }}
30+
31+
- name: Checkout
32+
uses: actions/checkout@v3
33+
34+
- uses: mr-smithers-excellent/docker-build-push@v5
35+
name: Build & push Docker image
36+
with:
37+
image: meta-flutter/ubuntu-20-user
38+
tags: main
39+
registry: ghcr.io
40+
dockerfile: ubuntu-20-user/Dockerfile
41+
username: ${{ github.actor }}
42+
password: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/ubuntu22-user.yml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: ubuntu22-user-docker-build
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
tags:
8+
- 'v*'
9+
pull_request:
10+
branches:
11+
- 'main'
12+
13+
env:
14+
REGISTRY_USER: ${{ github.actor }}
15+
REGISTRY_PASSWORD: ${{ github.token }}
16+
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }}
17+
18+
jobs:
19+
20+
ubuntu-22-user:
21+
runs-on: ubuntu-latest
22+
steps:
23+
24+
- name: Log in to ghcr.io
25+
uses: redhat-actions/podman-login@v1.6
26+
with:
27+
username: ${{ env.REGISTRY_USER }}
28+
password: ${{ env.REGISTRY_PASSWORD }}
29+
registry: ${{ env.IMAGE_REGISTRY }}
30+
31+
- name: Checkout
32+
uses: actions/checkout@v3
33+
34+
- uses: mr-smithers-excellent/docker-build-push@v5
35+
name: Build & push Docker image
36+
with:
37+
image: meta-flutter/ubuntu-22-user
38+
tags: main
39+
registry: ghcr.io
40+
dockerfile: ubuntu-22-user/Dockerfile
41+
username: ${{ github.actor }}
42+
password: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/ubuntu24-user.yml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: ubuntu24-user-docker-build
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
tags:
8+
- 'v*'
9+
pull_request:
10+
branches:
11+
- 'main'
12+
13+
env:
14+
REGISTRY_USER: ${{ github.actor }}
15+
REGISTRY_PASSWORD: ${{ github.token }}
16+
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }}
17+
18+
jobs:
19+
20+
ubuntu-24-user:
21+
runs-on: ubuntu-latest
22+
steps:
23+
24+
- name: Log in to ghcr.io
25+
uses: redhat-actions/podman-login@v1.6
26+
with:
27+
username: ${{ env.REGISTRY_USER }}
28+
password: ${{ env.REGISTRY_PASSWORD }}
29+
registry: ${{ env.IMAGE_REGISTRY }}
30+
31+
- name: Checkout
32+
uses: actions/checkout@v3
33+
34+
- uses: mr-smithers-excellent/docker-build-push@v5
35+
name: Build & push Docker image
36+
with:
37+
image: meta-flutter/ubuntu-24-user
38+
tags: main
39+
registry: ghcr.io
40+
dockerfile: ubuntu-24-user/Dockerfile
41+
username: ${{ github.actor }}
42+
password: ${{ secrets.GITHUB_TOKEN }}

ubuntu-20-user/Dockerfile

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
FROM ubuntu:20.04
2+
3+
ARG TZ=America/Los_Angeles
4+
ENV DEBIAN_FRONTEND=noninteractive
5+
ARG USER_NAME="Joel Winarske"
6+
ARG USER_EMAIL="joel.winarske@gmail.com"
7+
ARG RUNNER_USER_UID=1001
8+
ARG DOCKER_GROUP_GID=121
9+
10+
USER root
11+
12+
RUN apt-get update
13+
RUN apt-get install -y locales openssh-client git git-core
14+
RUN apt-get install -y sudo python3 python3-pip python3-git
15+
RUN pip3 install virtualenv
16+
17+
# Runner user
18+
RUN adduser --disabled-password --gecos '' -u $RUNNER_USER_UID dev \
19+
&& groupadd docker --gid $DOCKER_GROUP_GID \
20+
&& usermod -aG sudo dev \
21+
&& usermod -aG docker dev \
22+
&& echo "%sudo ALL=(ALL:ALL) NOPASSWD:ALL" > /etc/sudoers \
23+
&& echo "Defaults env_keep += \"DEBIAN_FRONTEND\"" >> /etc/sudoers
24+
25+
RUN chown -R dev:dev /home/dev
26+
27+
RUN locale-gen en_US.UTF-8
28+
ENV LANG=en_US.UTF-8
29+
30+
USER dev
31+
32+
WORKDIR /home/dev
33+
34+
RUN echo '/home/dev/.ssh/id_rsa' | ssh-keygen -t rsa -b 2048 -C "${USER_EMAIL}"
35+
RUN git config --global user.email ${USER_EMAIL}
36+
RUN git config --global user.name "${USER_NAME}"

ubuntu-22-user/Dockerfile

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
FROM ubuntu:22.04
2+
3+
ARG TZ=America/Los_Angeles
4+
ENV DEBIAN_FRONTEND=noninteractive
5+
ARG USER_NAME="Joel Winarske"
6+
ARG USER_EMAIL="joel.winarske@gmail.com"
7+
ARG RUNNER_USER_UID=1001
8+
ARG DOCKER_GROUP_GID=121
9+
10+
USER root
11+
12+
RUN apt-get update
13+
RUN apt-get install -y locales openssh-client git git-core
14+
RUN apt-get install -y sudo python3 python3-pip python3-git
15+
RUN pip3 install virtualenv
16+
17+
# Runner user
18+
RUN adduser --disabled-password --gecos '' -u $RUNNER_USER_UID dev \
19+
&& groupadd docker --gid $DOCKER_GROUP_GID \
20+
&& usermod -aG sudo dev \
21+
&& usermod -aG docker dev \
22+
&& echo "%sudo ALL=(ALL:ALL) NOPASSWD:ALL" > /etc/sudoers \
23+
&& echo "Defaults env_keep += \"DEBIAN_FRONTEND\"" >> /etc/sudoers
24+
25+
RUN chown -R dev:dev /home/dev
26+
27+
RUN locale-gen en_US.UTF-8
28+
ENV LANG=en_US.UTF-8
29+
30+
USER dev
31+
32+
WORKDIR /home/dev
33+
34+
RUN echo '/home/dev/.ssh/id_rsa' | ssh-keygen -t rsa -b 2048 -C "${USER_EMAIL}"
35+
RUN git config --global user.email ${USER_EMAIL}
36+
RUN git config --global user.name "${USER_NAME}"

ubuntu-24-user/Dockerfile

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
FROM ubuntu:24.04
2+
3+
ARG TZ=America/Los_Angeles
4+
ENV DEBIAN_FRONTEND=noninteractive
5+
ARG USER_NAME="Joel Winarske"
6+
ARG USER_EMAIL="joel.winarske@gmail.com"
7+
ARG RUNNER_USER_UID=1001
8+
ARG DOCKER_GROUP_GID=121
9+
10+
USER root
11+
12+
RUN apt-get update
13+
RUN apt-get install -y locales openssh-client git git-core
14+
RUN apt-get install -y sudo python3 python3-pip python3-git python3-virtualenv
15+
16+
17+
# Runner user
18+
RUN adduser --disabled-password --gecos '' -u $RUNNER_USER_UID dev \
19+
&& groupadd docker --gid $DOCKER_GROUP_GID \
20+
&& usermod -aG sudo dev \
21+
&& usermod -aG docker dev \
22+
&& echo "%sudo ALL=(ALL:ALL) NOPASSWD:ALL" > /etc/sudoers \
23+
&& echo "Defaults env_keep += \"DEBIAN_FRONTEND\"" >> /etc/sudoers
24+
25+
RUN chown -R dev:dev /home/dev
26+
27+
RUN locale-gen en_US.UTF-8
28+
ENV LANG=en_US.UTF-8
29+
30+
USER dev
31+
32+
WORKDIR /home/dev
33+
34+
RUN echo '/home/dev/.ssh/id_rsa' | ssh-keygen -t rsa -b 2048 -C "${USER_EMAIL}"
35+
RUN git config --global user.email ${USER_EMAIL}
36+
RUN git config --global user.name "${USER_NAME}"

0 commit comments

Comments
 (0)