Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .devcontainer/Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
ARG FEDORA_VERSION="39"
FROM --platform=$TARGETPLATFORM registry.fedoraproject.org/fedora-toolbox:${FEDORA_VERSION}

ARG TARGETOS
ARG TARGETARCH

COPY gh-cli.repo /etc/yum.repos.d/gh-cli.repo
RUN dnf install -y \
curl \
gh \
jq \
neovim \
ragel \
shellcheck \
tree-sitter-cli \
yamllint \
zsh \
&& \
dnf clean all

ARG MDBOOK_VERSION="0.4.37"
RUN case "$TARGETARCH" in amd64) export arch=x86_64;; *) echo "unknown arch: $TARGETARCH"; exit 0;; esac; \
test "$TARGETOS" = linux || { echo "unknown os: $TARGETOS"; exit 0; }; \
curl -sSfL "https://github.com/rust-lang/mdBook/releases/download/v${MDBOOK_VERSION}/mdbook-v${MDBOOK_VERSION}-${arch}-unknown-linux-gnu.tar.gz" | \
tar xzC /usr/local/bin

ARG GO_VERSION="1.22"
COPY go_download.jq /root/go_download.jq
RUN curl -sSfL 'https://golang.org/dl/?mode=json&include=all' | \
jq -r -f /root/go_download.jq | \
sh -ex

ENV GOBIN=/usr/local/bin
RUN go=/usr/local/go/bin/go; \
for exe in \
github.com/go-delve/delve/cmd/dlv@latest \
github.com/mgechev/revive@latest \
github.com/wagoodman/dive@latest \
golang.org/x/tools/cmd/deadcode@latest \
golang.org/x/tools/gopls@latest \
; do \
echo ": $exe" ; \
$go install "$exe"; \
done; \
rm -rf $($go env GOCACHE GOPATH)

COPY profile.sh /etc/profile.d/claircore.sh
4 changes: 4 additions & 0 deletions .devcontainer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
This devcontainer setup is mostly for creating a toolbx image.

None of the core contributors use a workflow that integrates devcontainers, so
it's largely untested _as_ a devcontainer.
23 changes: 23 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "Claircore",
"build": {
"dockerfile": "Containerfile",
"args": {
"FEDORA_VERSION": "39",
"GO_VERSION": "1.22",
"MDBOOK_VERSION": "0.4.37"
}
},
"mounts": [
{
"type": "bind",
"source": "${localEnv:HOME}/.cache/clair-testing",
"target": "/root/.cache/clair-testing"
},
{
"type": "bind",
"source": "${localEnv:HOME}/go/pkg/mod",
"target": "/root/go/pkg/mod"
}
]
}
5 changes: 5 additions & 0 deletions .devcontainer/gh-cli.repo
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[gh-cli]
name=packages for the GitHub CLI
baseurl=https://cli.github.com/packages/rpm
enabled=1
gpgkey=https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x23F3D4EA75716059
17 changes: 17 additions & 0 deletions .devcontainer/go_download.jq
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[
.[] |
select(
(.version | startswith("go\($ENV.GO_VERSION)"))
and
.stable
) |
.files[] |
select(
.os==$ENV.TARGETOS
and
.arch==$ENV.TARGETARCH
)
] |
first |
@uri "https://golang.org/dl/\(.filename)" |
@sh "curl -sSfL \(.) | tar xzC /usr/local"
9 changes: 9 additions & 0 deletions .devcontainer/profile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# shellcheck shell=sh

pathmunge /usr/local/go/bin

if [ "$(hostname)" == toolbox ]; then
HOSTNAME="$(. /run/.containerenv && echo "$name")"
export HOSTNAME HOST="$HOSTNAME"
sudo hostname "${HOSTNAME}" || :
fi