Skip to content

Commit

Permalink
Add Gentoo dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxattax97 committed Aug 31, 2024
1 parent 9129d50 commit 8ef7ad3
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,41 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

build-gentoo:
name: Gentoo Docker Image
runs-on: ubuntu-latest

permissions:
contents: read
packages: read

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
# super-linter needs the full git history to get the
# list of files that changed across commits
fetch-depth: 0

- name: Log in to Docker Hub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/[email protected]
with:
images: dotfiles
tags: gentoo

- name: Build and push Docker image
uses: docker/[email protected]
with:
context: .
file: ./Dockerfile.gentoo
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
34 changes: 34 additions & 0 deletions Dockerfile.gentoo
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
FROM gentoo/stage3:amd64-openrc

# This is a very up-to-date image, so we aren't going to lock package versions.
# hadolint ignore=DL3041
RUN emerge --verbose --noreplace \
net-misc/curl \
dev-vcs/git \
app-admin/sudo \
sys-apps/coreutils && \
emerge --verbose --depclean

RUN useradd -m max && \
echo "max ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
USER max
ENV USER=max

# NOTE: This is dangerous because it will include decrypted secrets in the image!
#RUN mkdir -p /home/max/src/miscellaneous
#COPY --chown=max . /home/max/src/miscellaneous/

RUN mkdir -p /home/max/src && \
git clone https://github.com/Maxattax97/miscellaneous.git /home/max/src/miscellaneous

# Overwrite the install script with the latest one in the repository.
COPY --chown=max install.sh /home/max/src/miscellaneous/install.sh

WORKDIR /home/max/src/miscellaneous
RUN /bin/sh -o pipefail -c "yes | \
AUTOMATED=1 /home/max/src/miscellaneous/install.sh && \
emerge --verbose --depclean"

WORKDIR /home/max
ENTRYPOINT ["/bin/zsh"]
HEALTHCHECK NONE

0 comments on commit 8ef7ad3

Please sign in to comment.