working devcontainer

This commit is contained in:
usrbinkat 2025-01-30 00:37:01 +00:00
parent d7f363bcaf
commit ed30ee7840

View File

@ -1,9 +1,7 @@
# TODO:
# - add gitpod cli https://gitpod.io/static/bin/gitpod-cli-linux-amd64
FROM docker.io/library/rust:1.84.0-bullseye
ENV SHELL="/bin/bash"
ENV BASH_FLAGS="-e"
ENV BIN=/usr/local/bin
SHELL ["/bin/bash", "-c"]
# Create a non-root user with same UID/GID as host user
ARG USERNAME=vscode
@ -11,12 +9,12 @@ ARG USER_UID=1000
ARG USER_GID=$USER_UID
# Install basic tools
#gitlab-cli \
ARG APT_LIST="\
jq \
git \
sudo \
curl \
gitlab-cli \
build-essential \
"
RUN set -ex \
@ -31,32 +29,33 @@ RUN groupadd --gid $USER_GID $USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME
# Install GitHub `gh` cli from github.com/cli/cli
RUN set -ex \
RUN set ${BASH_FLAGS} \
&& export NAME=gh \
&& export TEST="${NAME} version" \
&& export REPOSITORY="cli/cli" \
&& export VERSION="$(curl -Lks https://api.github.com/repos/${REPOSITORY}/releases/latest | jq --raw-output .tag_name)" \
&& export VERSION_TAG="$(curl -Lks https://api.github.com/repos/${REPOSITORY}/releases/latest | jq --raw-output .tag_name)" \
&& export VERSION="${VERSION_TAG#v}" \
&& export ARCH=$(uname -m | awk '{ if ($1 == "x86_64") print "amd64"; else if ($1 == "aarch64" || $1 == "arm64") print "arm64"; else print "unknown" }') \
&& export PKG="${NAME}_${VERSION:1}_linux_${ARCH}.tar.gz" \
&& export URL="https://github.com/${REPOSITORY}/releases/download/${VERSION}/${PKG}" \
&& export PKG="${NAME}_${VERSION}_linux_${ARCH}.tar.gz" \
&& export URL="https://github.com/${REPOSITORY}/releases/download/${VERSION_TAG}/${PKG}" \
&& echo "---------------------------------------------------------"\
&& echo "INFO[${NAME}] Installed:" \
&& echo "INFO[${NAME}] Command: ${NAME}" \
&& echo "INFO[${NAME}] Package: ${PKG}" \
&& echo "INFO[${NAME}] Latest Release: ${VERSION}" \
&& echo "INFO[${NAME}] Latest Release: ${VERSION_TAG}" \
&& echo "INFO[${NAME}] Architecture: ${ARCH}" \
&& echo "INFO[${NAME}] Source: ${URL}" \
&& echo "---------------------------------------------------------"\
&& curl -Lks ${URL} | tar xzvf - --directory /tmp \
&& sudo install -m 755 /tmp/${NAME}_${VERSION:1}_linux_${ARCH}/bin/${NAME} ${BIN}/${NAME} \
&& rm -rf /tmp/${NAME}_${VERSION:1}_linux_${ARCH} \
&& sudo install -m 755 /tmp/${NAME}_${VERSION}_linux_${ARCH}/bin/${NAME} ${BIN}/${NAME} \
&& rm -rf /tmp/${NAME}_${VERSION}_linux_${ARCH} \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean \
&& ${TEST} \
&& echo
# Install Gitpod CLI from gitpod.io
RUN set -ex \
RUN set ${BASH_FLAGS} \
&& export NAME=gp \
&& export TEST="${NAME} version" \
&& export VERSION="$(curl -s https://gitpod.io/static/bin/manifest.json | jq --raw-output .version)" \
@ -77,6 +76,28 @@ RUN set -ex \
&& ${TEST} \
&& echo
# Install GitLab CLI (glab) from gitlab.com/gitlab-org/cli
RUN set ${BASH_FLAGS} \
&& export NAME=glab \
&& export TEST="${NAME} version" \
&& export VERSION_TAG="$(curl -s "https://gitlab.com/api/v4/projects/gitlab-org%2Fcli/releases" | jq -r ".[0].tag_name")" \
&& export VERSION="${VERSION_TAG#v}" \
&& export ARCH=$(uname -m | awk '{ if ($1 == "x86_64") print "amd64"; else if ($1 == "aarch64" || $1 == "arm64") print "arm64"; else print "unknown" }') \
&& export PKG="${NAME}_${VERSION}_linux_${ARCH}.tar.gz" \
&& export URL="https://gitlab.com/gitlab-org/cli/-/releases/${VERSION_TAG}/downloads/${PKG}" \
&& echo "---------------------------------------------------------" \
&& echo "INFO[${NAME}] Installed:" \
&& echo "INFO[${NAME}] Command: ${NAME}" \
&& echo "INFO[${NAME}] Package: ${PKG}" \
&& echo "INFO[${NAME}] Latest Release: ${VERSION_TAG}" \
&& echo "INFO[${NAME}] Architecture: ${ARCH}" \
&& echo "INFO[${NAME}] Source: ${URL}" \
&& echo "---------------------------------------------------------" \
&& curl -fSL ${URL} | tar xz -C /tmp \
&& sudo mv /tmp/bin/glab /usr/local/bin/glab \
&& ${TEST} \
&& echo
# Set working directory
WORKDIR /workspaces/veilid
@ -87,5 +108,4 @@ USER $USERNAME
EXPOSE 5150
# Set default shell to bash
ENV SHELL="/bin/bash"
CMD ["sleep", "infinity"]