Skip to content

Commit

Permalink
User containers
Browse files Browse the repository at this point in the history
Signed-off-by: Joel Winarske <[email protected]>
  • Loading branch information
jwinarske committed Jan 19, 2025
1 parent 53cf2cd commit 7894699
Show file tree
Hide file tree
Showing 6 changed files with 234 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/ubuntu20-user.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: ubuntu20-user-docker-build

on:
push:
branches:
- 'main'
tags:
- 'v*'
pull_request:
branches:
- 'main'

env:
REGISTRY_USER: ${{ github.actor }}
REGISTRY_PASSWORD: ${{ github.token }}
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }}

jobs:

ubuntu-20-user:
runs-on: ubuntu-latest
steps:

- name: Log in to ghcr.io
uses: redhat-actions/[email protected]
with:
username: ${{ env.REGISTRY_USER }}
password: ${{ env.REGISTRY_PASSWORD }}
registry: ${{ env.IMAGE_REGISTRY }}

- name: Checkout
uses: actions/checkout@v3

- uses: mr-smithers-excellent/docker-build-push@v5
name: Build & push Docker image
with:
image: meta-flutter/ubuntu-20
tags: main
registry: ghcr.io
dockerfile: ubuntu-20-user/Dockerfile
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
42 changes: 42 additions & 0 deletions .github/workflows/ubuntu22-user.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: ubuntu22-user-docker-build

on:
push:
branches:
- 'main'
tags:
- 'v*'
pull_request:
branches:
- 'main'

env:
REGISTRY_USER: ${{ github.actor }}
REGISTRY_PASSWORD: ${{ github.token }}
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }}

jobs:

ubuntu-22-user:
runs-on: ubuntu-latest
steps:

- name: Log in to ghcr.io
uses: redhat-actions/[email protected]
with:
username: ${{ env.REGISTRY_USER }}
password: ${{ env.REGISTRY_PASSWORD }}
registry: ${{ env.IMAGE_REGISTRY }}

- name: Checkout
uses: actions/checkout@v3

- uses: mr-smithers-excellent/docker-build-push@v5
name: Build & push Docker image
with:
image: meta-flutter/ubuntu-22-user
tags: main
registry: ghcr.io
dockerfile: ubuntu-22-user/Dockerfile
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
42 changes: 42 additions & 0 deletions .github/workflows/ubuntu24-user.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: ubuntu24-user-docker-build

on:
push:
branches:
- 'main'
tags:
- 'v*'
pull_request:
branches:
- 'main'

env:
REGISTRY_USER: ${{ github.actor }}
REGISTRY_PASSWORD: ${{ github.token }}
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }}

jobs:

ubuntu-24-user:
runs-on: ubuntu-latest
steps:

- name: Log in to ghcr.io
uses: redhat-actions/[email protected]
with:
username: ${{ env.REGISTRY_USER }}
password: ${{ env.REGISTRY_PASSWORD }}
registry: ${{ env.IMAGE_REGISTRY }}

- name: Checkout
uses: actions/checkout@v3

- uses: mr-smithers-excellent/docker-build-push@v5
name: Build & push Docker image
with:
image: meta-flutter/ubuntu-24-user
tags: main
registry: ghcr.io
dockerfile: ubuntu-24-user/Dockerfile
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
36 changes: 36 additions & 0 deletions ubuntu-20-user/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM ubuntu:20.04

ARG TZ=America/Los_Angeles
ENV DEBIAN_FRONTEND=noninteractive
ARG USER_NAME="Joel Winarske"
ARG USER_EMAIL="[email protected]"
ARG RUNNER_USER_UID=1001
ARG DOCKER_GROUP_GID=121

USER root

RUN apt-get update
RUN apt-get install -y locales openssh-client git git-core
RUN apt-get install -y sudo python3 python3-pip python3-git
RUN pip3 install virtualenv

# Runner user
RUN adduser --disabled-password --gecos '' -u $RUNNER_USER_UID dev \
&& groupadd docker --gid $DOCKER_GROUP_GID \
&& usermod -aG sudo dev \
&& usermod -aG docker dev \
&& echo "%sudo ALL=(ALL:ALL) NOPASSWD:ALL" > /etc/sudoers \
&& echo "Defaults env_keep += \"DEBIAN_FRONTEND\"" >> /etc/sudoers

RUN chown -R dev:dev /home/dev

RUN locale-gen en_US.UTF-8
ENV LANG=en_US.UTF-8

USER dev

WORKDIR /home/dev

RUN echo '/home/dev/.ssh/id_rsa' | ssh-keygen -t rsa -b 2048 -C "${USER_EMAIL}"
RUN git config --global user.email ${USER_EMAIL}
RUN git config --global user.name "${USER_NAME}"
36 changes: 36 additions & 0 deletions ubuntu-22-user/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM ubuntu:22.04

ARG TZ=America/Los_Angeles
ENV DEBIAN_FRONTEND=noninteractive
ARG USER_NAME="Joel Winarske"
ARG USER_EMAIL="[email protected]"
ARG RUNNER_USER_UID=1001
ARG DOCKER_GROUP_GID=121

USER root

RUN apt-get update
RUN apt-get install -y locales openssh-client git git-core
RUN apt-get install -y sudo python3 python3-pip python3-git
RUN pip3 install virtualenv

# Runner user
RUN adduser --disabled-password --gecos '' -u $RUNNER_USER_UID dev \
&& groupadd docker --gid $DOCKER_GROUP_GID \
&& usermod -aG sudo dev \
&& usermod -aG docker dev \
&& echo "%sudo ALL=(ALL:ALL) NOPASSWD:ALL" > /etc/sudoers \
&& echo "Defaults env_keep += \"DEBIAN_FRONTEND\"" >> /etc/sudoers

RUN chown -R dev:dev /home/dev

RUN locale-gen en_US.UTF-8
ENV LANG=en_US.UTF-8

USER dev

WORKDIR /home/dev

RUN echo '/home/dev/.ssh/id_rsa' | ssh-keygen -t rsa -b 2048 -C "${USER_EMAIL}"
RUN git config --global user.email ${USER_EMAIL}
RUN git config --global user.name "${USER_NAME}"
36 changes: 36 additions & 0 deletions ubuntu-24-user/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM ubuntu:24.04

ARG TZ=America/Los_Angeles
ENV DEBIAN_FRONTEND=noninteractive
ARG USER_NAME="Joel Winarske"
ARG USER_EMAIL="[email protected]"
ARG RUNNER_USER_UID=1001
ARG DOCKER_GROUP_GID=121

USER root

RUN apt-get update
RUN apt-get install -y locales openssh-client git git-core
RUN apt-get install -y sudo python3 python3-pip python3-git python3-virtualenv


# Runner user
RUN adduser --disabled-password --gecos '' -u $RUNNER_USER_UID dev \
&& groupadd docker --gid $DOCKER_GROUP_GID \
&& usermod -aG sudo dev \
&& usermod -aG docker dev \
&& echo "%sudo ALL=(ALL:ALL) NOPASSWD:ALL" > /etc/sudoers \
&& echo "Defaults env_keep += \"DEBIAN_FRONTEND\"" >> /etc/sudoers

RUN chown -R dev:dev /home/dev

RUN locale-gen en_US.UTF-8
ENV LANG=en_US.UTF-8

USER dev

WORKDIR /home/dev

RUN echo '/home/dev/.ssh/id_rsa' | ssh-keygen -t rsa -b 2048 -C "${USER_EMAIL}"
RUN git config --global user.email ${USER_EMAIL}
RUN git config --global user.name "${USER_NAME}"

0 comments on commit 7894699

Please sign in to comment.