diff --git a/devfiles/go-web-sample/devfile.yaml b/devfiles/go-web-sample/devfile.yaml new file mode 100644 index 000000000..8e1850571 --- /dev/null +++ b/devfiles/go-web-sample/devfile.yaml @@ -0,0 +1,94 @@ +--- +apiVersion: 1.0.0 +metadata: + generateName: golang-realworld-app- +projects: +- + name: example + source: + type: git + location: https://github.com/xesina/golang-echo-realworld-example-app + clonePath: golang-realworld-app +components: +- + type: chePlugin + id: ms-vscode/go/latest + alias: go-plugin + memoryLimit: 512Mi + preferences: + go.formatTool: goimports + go.useLanguageServer: true +- + type: dockerimage + image: quay.io/eclipse/che-golang-1.12:nightly + alias: go-cli + env: + - name: GOPATH + # replicate the GOPATH from the plugin + value: /go:$(CHE_PROJECTS_ROOT) + - name: GOCACHE + # replicate the GOCACHE from the plugin, even though the cache is not shared + # between the two + value: /tmp/.cache + - name: GO111MODULE + value: 'on' + memoryLimit: 512Mi + mountSources: true +commands: +- + name: install dependencies + actions: + - type: exec + component: go-cli + command: go mod download + workdir: ${CHE_PROJECTS_ROOT}/golang-realworld-app +- + name: run + actions: + - type: exec + component: go-cli + command: go run main.go + workdir: ${CHE_PROJECTS_ROOT}/golang-realworld-app +- + name: build + actions: + - type: exec + component: go-cli + command: echo "Build starting." && go build -v && echo "Build complete." + workdir: ${CHE_PROJECTS_ROOT}/golang-realworld-app +- + name: test + actions: + - type: exec + component: go-cli + command: go test ./... + workdir: ${CHE_PROJECTS_ROOT}/golang-realworld-app +- + name: user create + actions: + - type: exec + component: go-cli + command: "curl --header \"Content-Type: application/json\" --request POST --data '{\"user\": {\"Username\":\"user\", \"Email\":\"user@user.user\", \"Password\": \"password\"}}' localhost:8585/api/users" +- + name: user login + actions: + - type: exec + component: go-cli + command: "curl --header \"Content-Type: application/json\" --request POST --data '{\"user\": {\"Email\":\"user@user.user\", \"Password\": \"password\"}}' localhost:8585/api/users/login" +- + name: Debug current file + actions: + - type: vscode-launch + referenceContent: | + { + "version": "0.2.0", + "configurations": [ + { + "name": "Debug current file", + "type": "go", + "request": "launch", + "mode": "auto", + "program": "${fileDirname}", + }, + ] + } diff --git a/devfiles/go-web-sample/meta.yaml b/devfiles/go-web-sample/meta.yaml new file mode 100644 index 000000000..160167919 --- /dev/null +++ b/devfiles/go-web-sample/meta.yaml @@ -0,0 +1,6 @@ +--- +displayName: Go Real World Application +description: Go Stack with Go 1.12 and Real World Application +tags: ["Debian", "Go"] +icon: https://www.eclipse.org/che/images/logo-eclipseche.svg +globalMemoryLimit: 1686Mi