feat: ensure related go source and vscode plugins are installed in devcontainer

This commit is contained in:
Jose Diaz-Gonzalez
2021-11-12 15:50:57 -05:00
parent bb54231233
commit 02b3b8e7e6
5 changed files with 42 additions and 4 deletions

View File

@@ -7,6 +7,12 @@ RUN apt-get install --no-install-recommends -y build-essential file nano && \
apt-get autoremove --yes && \
rm -rf /var/lib/apt/lists/*
RUN wget https://dl.google.com/go/go1.16.10.linux-amd64.tar.gz && \
tar -xvf go1.16.10.linux-amd64.tar.gz && \
mv go /usr/local
RUN GOROOT=/usr/local/go /usr/local/go/bin/go install golang.org/x/tools/gopls@latest 2>&1
ADD https://raw.githubusercontent.com/dokku/dokku/master/tests/dhparam.pem /mnt/dokku/etc/nginx/dhparam.pem
COPY .devcontainer/bin/ /usr/local/bin/
@@ -15,5 +21,6 @@ RUN make ci-dependencies
COPY . .
ENV DOKKU_HOSTNAME=dokku.me
ENV DOKKU_HOSTNAME=dokku.me GOROOT=/usr/local/go PATH=/usr/local/go/bin:$PATH PLUGIN_MAKE_TARGET=build
LABEL org.label-schema.schema-version=1.0 org.label-schema.vendor=dokku com.dokku.devcontainer=true

View File

@@ -3,7 +3,7 @@
main() {
declare PLUGIN_NAME="$1"
make go-build-plugin copyplugin PLUGIN_NAME=$PLUGIN_NAME
make go-build-plugin copyplugin PLUGIN_NAME=$PLUGIN_NAME PLUGIN_MAKE_TARGET=build
}
main "$@"

View File

@@ -0,0 +1,23 @@
#!/usr/bin/env bash
set -x
main() {
find plugins/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | while read plugin; do
if [[ ! -f "plugins/$plugin/go.mod" ]]; then
continue
fi
pushd "plugins/$plugin" >/dev/null || return 1
echo "====> Cloning all modules $plugin"
go list -m -f '{{define "M"}}git clone https://{{.Path}}.git /root/go/src/{{.Path}} || true && echo {{.Version}}{{end}}{{if not .Main}}{{if not .Replace}}{{template "M" .}}{{end}}{{end}}' all >tmp-file
bash tmp-file
rm tmp-file
go list -m -f '{{define "M"}}git clone https://{{.Path}}.git /usr/local/go/src/{{.Path}} || true && echo {{.Version}}{{end}}{{if not .Main}}{{if not .Replace}}{{template "M" .}}{{end}}{{end}}' all >tmp-file
bash tmp-file
rm tmp-file
popd >/dev/null || return 1
done
}
main "$@"

View File

@@ -7,12 +7,19 @@
"DOKKU_HOST_ROOT": "${localWorkspaceFolder}/tmp/data/home/dokku",
"GO_ROOT_MOUNT": "${localWorkspaceFolder}:/go/src/github.com/dokku/dokku"
},
"extensions": [
"golang.go",
"mads-hartmann.bash-ide-vscode",
"ms-vscode.makefile-tools"
],
"initializeCommand": ["mkdir", "-p", "tmp/data"],
"mounts": [
"source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind",
"source=${localWorkspaceFolder}/tmp/data/,target=/mnt/dokku/,type=bind"
],
"overrideCommand": false,
"postCreateCommand": ["make", "setup-deploy-tests"],
"runArgs": ["--init"]
"postCreateCommand": "make setup-deploy-tests && go-mod-downloadall",
"runArgs": ["--init"],
"workspaceFolder": "/root/go/src/github.com/dokku/dokku",
"workspaceMount": "type=bind,source=${localWorkspaceFolder},target=/root/go/src/github.com/dokku/dokku,consistency=cached"
}

1
.gitignore vendored
View File

@@ -3,6 +3,7 @@
.DS_Store
.ruby-version
.idea/
.vscode/
.vagrant
build/
data/