Merge pull request #4920 from dokku/full-devcontainer-env

Ensure related go source and vscode plugins are installed in devcontainer
This commit is contained in:
Jose Diaz-Gonzalez authored and GitHub committed 2021-11-12 17:02:48 -05:00
commit 78a984b52f
5 files changed
+42 -4

No files matched your search

+8 -1
View File
@@ -7,6 +7,12 @@ RUN apt-get install --no-install-recommends -y build-essential file nano && \
apt-get autoremove --yes && \ apt-get autoremove --yes && \
rm -rf /var/lib/apt/lists/* 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 ADD https://raw.githubusercontent.com/dokku/dokku/master/tests/dhparam.pem /mnt/dokku/etc/nginx/dhparam.pem
COPY .devcontainer/bin/ /usr/local/bin/ COPY .devcontainer/bin/ /usr/local/bin/
@@ -15,5 +21,6 @@ RUN make ci-dependencies
COPY . . 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 LABEL org.label-schema.schema-version=1.0 org.label-schema.vendor=dokku com.dokku.devcontainer=true
+1 -1
View File
@@ -3,7 +3,7 @@
main() { main() {
declare PLUGIN_NAME="$1" 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 "$@" main "$@"
+23
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 "$@"
+9 -2
View File
@@ -7,12 +7,19 @@
"DOKKU_HOST_ROOT": "${localWorkspaceFolder}/tmp/data/home/dokku", "DOKKU_HOST_ROOT": "${localWorkspaceFolder}/tmp/data/home/dokku",
"GO_ROOT_MOUNT": "${localWorkspaceFolder}:/go/src/github.com/dokku/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"], "initializeCommand": ["mkdir", "-p", "tmp/data"],
"mounts": [ "mounts": [
"source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind", "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind",
"source=${localWorkspaceFolder}/tmp/data/,target=/mnt/dokku/,type=bind" "source=${localWorkspaceFolder}/tmp/data/,target=/mnt/dokku/,type=bind"
], ],
"overrideCommand": false, "overrideCommand": false,
"postCreateCommand": ["make", "setup-deploy-tests"], "postCreateCommand": "make setup-deploy-tests && go-mod-downloadall",
"runArgs": ["--init"] "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
View File
@@ -3,6 +3,7 @@
.DS_Store .DS_Store
.ruby-version .ruby-version
.idea/ .idea/
.vscode/
.vagrant .vagrant
build/ build/
data/ data/