Skip to content

Commit 9bc517d

Browse files
committed
feat: add fedora-toolbox
1 parent 952e4da commit 9bc517d

File tree

2 files changed

+147
-1
lines changed

2 files changed

+147
-1
lines changed

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ This repository collects all of my containerization works and serves as a templa
2424
| [docker-SillyTavern](https://github.com/jim60105/docker-SillyTavern) | Node.js project containerization + Helm chart. | [🔗](https://github.com/jim60105/docker-SillyTavern/blob/master/Dockerfile) |
2525
| [YoutubeLiveChatToDiscord](https://github.com/jim60105/YoutubeLiveChatToDiscord) | C# .NET 8 project with runtime-deps image + self-contained + publish-trimmed. | [🔗](https://github.com/jim60105/YoutubeLiveChatToDiscord/blob/master/Dockerfile) |
2626
| [backup-dl](https://github.com/jim60105/backup-dl) | C# .NET 8 project with runtime-deps image + self-contained + publish-trimmed. | [🔗](https://github.com/jim60105/backup-dl/blob/master/Dockerfile) |
27+
| [toolbx](https://github.com/jim60105/toolbx) | [Toolbx](https://docs.fedoraproject.org/en-US/fedora-silverblue/toolbox/) is a tool for Linux, which allows the use of interactive command line environments for software development and troubleshooting the host operating system, without having to install software on the host. These are my personal Fedora toolbox images, which I use for development and daily usage. | [🔗](https://github.com/jim60105/toolbx/blob/master/base.Containerfile) |
28+
| [docker-OpenTelemetry](https://github.com/jim60105/docker-OpenTelemetry) | Docker compose for deploying OpenTelemetry Monitoring Solution with Docker | |
2729
| [docker-Nextcloud](https://github.com/jim60105/docker-Nextcloud) | Docker compose file for Nextcloud. | |
2830
| [docker-minecraft](https://github.com/jim60105/docker-minecraft) | Docker compose file for my Minecraft server. Contains a simple solution to deal with the problem of Podman not having GELF log driver. | |
2931
| [docker-ReverseProxy](https://github.com/jim60105/docker-ReverseProxy) | Docker compose file for Reverse Proxy with automatic SSL certificate generation. I use it for my personal VPS reverse proxy. | |
@@ -80,7 +82,7 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY
8082
You should have received a copy of the GNU General Public License along with this program. If not, see [https://www.gnu.org/licenses/](https://www.gnu.org/licenses/).
8183

8284
> [!CAUTION]
83-
> A GPLv3 licensed Dockerfile means that you _**MUST**_ **distribute the source code with the same license**, if you
85+
> A GPLv3 licensed Dockerfile means that you ***MUST*** **distribute the source code with the same license**, if you
8486
>
8587
> - Re-distribute the image. (You can simply point to this GitHub repository if you doesn't made any code changes.)
8688
> - Distribute a image that uses code from this repository.

fedora-toolbox/base.Containerfile

+144
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
# syntax=docker/dockerfile:1
2+
ARG UID=1000
3+
ARG VERSION=EDGE
4+
ARG RELEASE=0
5+
ARG BASE_IMAGE=registry.fedoraproject.org/fedora-toolbox:41
6+
7+
########################################
8+
# Base stage
9+
########################################
10+
FROM ${BASE_IMAGE} AS base
11+
12+
# Set dnf config
13+
RUN cat <<-"EOF" > /etc/dnf/dnf.conf
14+
[main]
15+
install_weak_deps=False
16+
tsflags=nodocs
17+
EOF
18+
19+
########################################
20+
# Font unpack stage
21+
########################################
22+
FROM base AS font-unpacker
23+
24+
WORKDIR /fonts
25+
26+
ADD https://github.com/ButTaiwan/iansui/releases/download/v1.000/iansui.zip /tmp/iansui.zip
27+
28+
ADD https://github.com/ryanoasis/nerd-fonts/releases/download/v3.3.0/Hack.zip /tmp/hack.zip
29+
30+
RUN unzip -uo /tmp/iansui.zip -d /fonts/iansui && \
31+
unzip -uo /tmp/hack.zip -d /fonts/hack
32+
33+
########################################
34+
# Host runner stage
35+
########################################
36+
FROM base AS host-runner
37+
38+
WORKDIR /host-runner
39+
40+
RUN cat <<-"EOF" > /host-runner/host-runner
41+
#!/bin/bash
42+
executable="$(basename ${0})"
43+
exec flatpak-spawn --host "${executable}" "${@}"
44+
EOF
45+
46+
# Setup host-runner script and symlinks
47+
RUN bins=( \
48+
"flatpak" \
49+
"podman" \
50+
"docker" \
51+
"rpm-ostree" \
52+
"systemctl" \
53+
"xdg-open" \
54+
"kitty" \
55+
); \
56+
for f in "${bins[@]}"; do \
57+
ln -s host-runner "/host-runner/$f";\
58+
done
59+
60+
########################################
61+
# Final stage
62+
########################################
63+
FROM base AS final
64+
65+
# Create directories with correct permissions
66+
ARG UID
67+
RUN install -d -m 775 -o $UID -g 0 /licenses
68+
69+
# Copy licenses (OpenShift Policy)
70+
COPY --chown=$UID:0 --chmod=775 LICENSE /licenses/Containerfile.LICENSE
71+
72+
# COPY host-runner
73+
COPY --chown=$UID:0 --chmod=775 --from=host-runner /host-runner /usr/local/bin
74+
75+
# RUN mount cache for multi-arch: https://github.com/docker/buildx/issues/549#issuecomment-1788297892
76+
ARG TARGETARCH
77+
ARG TARGETVARIANT
78+
79+
# Make sure the cache is refreshed
80+
ARG RELEASE
81+
82+
# Install utilities
83+
RUN --mount=type=cache,id=dnf-$TARGETARCH$TARGETVARIANT,sharing=locked,target=/var/cache/dnf \
84+
dnf -y upgrade && \
85+
dnf -y install \
86+
xdg-utils \
87+
jq
88+
89+
# Fonts
90+
COPY --chown=$UID:0 --chmod=775 --from=font-unpacker /fonts /usr/local/share/fonts
91+
RUN --mount=type=cache,id=dnf-$TARGETARCH$TARGETVARIANT,sharing=locked,target=/var/cache/dnf \
92+
dnf -y install \
93+
google-noto-sans-cjk-fonts \
94+
cascadia-fonts-all \
95+
hanamin-fonts
96+
97+
# Install os keyring
98+
#! Following this guide to setup os keyring to use gnome-libsecret:
99+
# https://code.visualstudio.com/docs/editor/settings-sync#_recommended-configure-the-keyring-to-use-with-vs-code
100+
ENV GCM_CREDENTIAL_STORE=gpg
101+
RUN --mount=type=cache,id=dnf-$TARGETARCH$TARGETVARIANT,sharing=locked,target=/var/cache/dnf \
102+
dnf -y install seahorse
103+
104+
# Install .NET
105+
RUN --mount=type=cache,id=dnf-$TARGETARCH$TARGETVARIANT,sharing=locked,target=/var/cache/dnf \
106+
dnf -y install dotnet-sdk-8.0
107+
108+
# Install Rustup
109+
RUN --mount=type=cache,id=dnf-$TARGETARCH$TARGETVARIANT,sharing=locked,target=/var/cache/dnf \
110+
dnf -y install rustup
111+
112+
# Install Java 17 (JetBrains loves this)
113+
RUN --mount=type=cache,id=dnf-$TARGETARCH$TARGETVARIANT,sharing=locked,target=/var/cache/dnf \
114+
dnf -y install java-17-openjdk
115+
116+
# Install git-credential-manager (This needs .NET 8)
117+
RUN curl -L https://aka.ms/gcm/linux-install-source.sh | sh && \
118+
git-credential-manager configure
119+
120+
# Install aria2
121+
RUN --mount=type=cache,id=dnf-$TARGETARCH$TARGETVARIANT,sharing=locked,target=/var/cache/dnf \
122+
dnf -y install aria2
123+
124+
# Copy toolbox runners
125+
COPY --chown=$UID:0 --chmod=775 video/runner /copy-to-host
126+
127+
ARG VERSION
128+
ARG RELEASE
129+
LABEL name="jim60105/toolbx" \
130+
org.opencontainers.image.name="jim60105/toolbx" \
131+
# Authors for toolbox
132+
vendor="Fedora Project" \
133+
# Maintainer for this container image
134+
maintainer="jim60105" \
135+
# Containerfile source repository
136+
url="https://github.com/jim60105/toolbx" \
137+
version=${VERSION} \
138+
# This should be a number, incremented with each change
139+
release=${RELEASE} \
140+
io.k8s.display-name="toolbx" \
141+
summary="toolbx: My Personal Fedora Toolbox (Containerfile)" \
142+
description="Toolbx is a tool for Linux, which allows the use of interactive command line environments for software development and troubleshooting the host operating system, without having to install software on the host. These are my personal Fedora toolbox images, which I use for development and daily usage. For more information about this tool, please visit the following website: https://github.com/jim60105/toolbx" \
143+
license="GPL-3.0" \
144+
org.opencontainers.image.license="GPL-3.0"

0 commit comments

Comments
 (0)