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

Spruce up devcontainer #20

Merged
merged 1 commit into from
Apr 16, 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
46 changes: 41 additions & 5 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,58 @@ ARG USERNAME=builder
ARG USER_UID=1000
ARG USER_GID=$USER_UID

FROM ${BASE_IMAGE}

ENV DEBIAN_FRONTENT=noninteractive
FROM ${BASE_IMAGE} AS packages

RUN apt-get update && apt-get upgrade -y && apt-get install libffi-dev
ENV DEBIAN_FRONTEND=noninteractive

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


FROM packages AS go_install

ARG GO_URL

ADD ${GO_URL} /usr/src/go.tar.gz

RUN tar -C /opt -xvf /usr/src/go.tar.gz


FROM packages AS builder

COPY --from=go_install /opt/go/ /opt/go/
ENV PATH=/opt/go/bin:$PATH

ARG USERNAME USER_UID USER_GID

RUN groupadd -g ${USER_GID} ${USERNAME} && useradd -m -u ${USER_UID} -g ${USERNAME} -s /bin/bash ${USERNAME}

USER ${USERNAME}
WORKDIR /home/${USERNAME}
ENV USER=${USERNAME} SHELL=/bin/bash
ENV USER=${USERNAME} SHELL=/bin/bash GOPATH=/home/${USERNAME}/go


FROM builder AS go_tools

RUN go install golang.org/x/tools/gopls@latest
RUN go install github.com/go-delve/delve/cmd/dlv@latest
RUN go install github.com/ramya-rao-a/go-outline@latest
RUN go install github.com/josharian/impl@latest
RUN go install github.com/fatih/gomodifytags@latest
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 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 devcontainer

ARG USERNAME

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

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

ENV PATH=/home/${USERNAME}/go/bin:/home/${USERNAME}/.local/bin:$PATH
9 changes: 8 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,20 @@
"path": "/bin/bash"
}
},
"python.defaultInterpreterPath": "/opt/python/cp36-cp36/bin/python3",
"python.defaultInterpreterPath": "/opt/python/cp310-cp310/bin/python3",
"go.toolsEnvVars": {
"CGO_CFLAGS": "-I/opt/python/cp310-cp310/include/python3.10",
"CGO_LDFLAGS": "-Wl,--unresolved-symbols=ignore-all"
},
"C_Cpp.default.includePath": ["/opt/python/cp310-cp310/include/python3.10"]
},
"extensions": [
"bierner.github-markdown-preview",
"eamodio.gitlens",
"golang.go",
"ms-python.python",
"ms-python.vscode-pylance",
"ms-vscode.cpptools",
"oderwat.indent-rainbow",
],
}
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[tool.isort]
profile = "black"
lines_between_types = 1
4 changes: 4 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ python =
[testenv]
deps = -r development.txt
commands = pytest -v

[flake8]
max-line-length = 180
extend-ignore = E203, W503