Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fully tricked-out devcontainer #31

Merged
merged 1 commit into from
Apr 20, 2022
Merged
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
30 changes: 28 additions & 2 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
ARG BASE_IMAGE=quay.io/pypa/manylinux_2_24_x86_64
ARG GO_URL=https://go.dev/dl/go1.18.1.linux-amd64.tar.gz
ARG SHELLCHECK_URL=https://github.com/koalaman/shellcheck/releases/download/v0.8.0/shellcheck-v0.8.0.linux.x86_64.tar.xz
ARG MCFLY_URL=https://github.com/cantino/mcfly/releases/download/v0.6.0/mcfly-v0.6.0-x86_64-unknown-linux-musl.tar.gz

ARG USERNAME=builder
ARG USER_UID=1000
Expand All @@ -11,9 +13,11 @@ FROM ${BASE_IMAGE} AS packages
ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get upgrade -y && apt-get install -y \
build-essential clang-format gdb libffi-dev valgrind \
build-essential clang-format gdb less libffi-dev valgrind \
curl ca-certificates gnupg2 tar g++ gcc libc6-dev make pkg-config

RUN curl -sS https://starship.rs/install.sh | sh -s -- -y


FROM packages AS go_install

Expand Down Expand Up @@ -49,15 +53,37 @@ RUN go install github.com/haya14busa/goplay/cmd/goplay@latest
RUN go install github.com/cweill/gotests/...@latest
RUN go install honnef.co/go/tools/cmd/staticcheck@latest
RUN go install mvdan.cc/gofumpt@latest
RUN go install mvdan.cc/sh/v3/cmd/shfmt@latest
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.45.2


FROM builder AS misc

ARG SHELLCHECK_URL MCFLY_URL USERNAME

ADD --chown=${USERNAME} ${SHELLCHECK_URL} /usr/src/shellcheck.tar.xz

RUN mkdir /tmp/shellcheck && tar -C /tmp/shellcheck --strip-components=1 -xvf /usr/src/shellcheck.tar.xz

ADD --chown=${USERNAME} ${MCFLY_URL} /usr/src/mcfly.tar.gz

RUN mkdir /tmp/mcfly && tar -C /tmp/mcfly -xvf /usr/src/mcfly.tar.gz


FROM builder AS devcontainer

ARG USERNAME

RUN echo "set auto-load safe-path /" > /home/${USERNAME}/.gdbinit

COPY --from=go_tools /home/${USERNAME}/go/bin/ /home/${USERNAME}/go/bin

RUN python3.10 -m pip install --user black isort pytest tox

ENV PATH=/home/${USERNAME}/go/bin:/home/${USERNAME}/.local/bin:$PATH
COPY --from=misc /tmp/shellcheck/shellcheck /home/${USERNAME}/.local/bin/shellcheck
COPY --from=misc /tmp/mcfly/mcfly /home/${USERNAME}/.local/bin/mcfly

RUN echo 'eval "$(mcfly init bash)"' >> ~/.bashrc && touch ~/.bash_history
RUN echo 'eval "$(starship init bash)"' >> ~/.bashrc

ENV PATH=/home/${USERNAME}/go/bin:/home/${USERNAME}/.local/bin:/opt/python/cp310-cp310/bin:$PATH
4 changes: 4 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,14 @@
"extensions": [
"bierner.github-markdown-preview",
"eamodio.gitlens",
"foxundermoon.shell-format",
"golang.go",
"ms-azuretools.vscode-docker",
"ms-python.python",
"ms-python.vscode-pylance",
"ms-vscode.cpptools",
"oderwat.indent-rainbow",
"tamasfe.even-better-toml",
"timonwong.shellcheck"
],
}