This repository has been archived by the owner on Mar 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
152 changed files
with
28,314 additions
and
4,244 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# Update the VARIANT arg in devcontainer.json to pick an Go version | ||
ARG VARIANT=1 | ||
FROM golang:1.14 | ||
|
||
# This Dockerfile adds a non-root user with sudo access. Update the “remoteUser” property in | ||
# devcontainer.json to use it. More info: https://aka.ms/vscode-remote/containers/non-root-user. | ||
ARG USERNAME=vscode | ||
ARG USER_UID=1000 | ||
ARG USER_GID=$USER_UID | ||
|
||
# Options for common setup script - SHA generated on release | ||
ARG INSTALL_ZSH="true" | ||
ARG UPGRADE_PACKAGES="false" | ||
ARG COMMON_SCRIPT_SOURCE="https://raw.githubusercontent.com/microsoft/vscode-dev-containers/master/script-library/common-debian.sh" | ||
ARG COMMON_SCRIPT_SHA="dev-mode" | ||
|
||
# Install needed packages and setup non-root user. Use a separate RUN statement to add your own dependencies. | ||
RUN apt-get update \ | ||
&& export DEBIAN_FRONTEND=noninteractive \ | ||
&& apt-get -y install --no-install-recommends curl ca-certificates 2>&1 \ | ||
&& curl -sSL ${COMMON_SCRIPT_SOURCE} -o /tmp/common-setup.sh \ | ||
&& ([ "${COMMON_SCRIPT_SHA}" = "dev-mode" ] || (echo "${COMMON_SCRIPT_SHA} /tmp/common-setup.sh" | sha256sum -c -)) \ | ||
&& /bin/bash /tmp/common-setup.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" \ | ||
# Clean up | ||
&& apt-get autoremove -y \ | ||
&& apt-get clean -y \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Use Docker within a Codespace | ||
# https://docs.microsoft.com/en-us/visualstudio/codespaces/reference/configuring#use-docker-within-a-codespace | ||
RUN groupadd -g 800 docker | ||
RUN usermod -a -G docker vscode | ||
|
||
# Install Go tools | ||
ARG GO_TOOLS_WITH_MODULES="\ | ||
golang.org/x/tools/gopls \ | ||
honnef.co/go/tools/... \ | ||
golang.org/x/tools/cmd/gorename \ | ||
golang.org/x/tools/cmd/goimports \ | ||
golang.org/x/tools/cmd/guru \ | ||
golang.org/x/lint/golint \ | ||
github.com/mdempsky/gocode \ | ||
github.com/cweill/gotests/... \ | ||
github.com/haya14busa/goplay/cmd/goplay \ | ||
github.com/sqs/goreturns \ | ||
github.com/josharian/impl \ | ||
github.com/davidrjenni/reftools/cmd/fillstruct \ | ||
github.com/uudashr/gopkgs/v2/cmd/gopkgs \ | ||
github.com/ramya-rao-a/go-outline \ | ||
github.com/acroca/go-symbols \ | ||
github.com/godoctor/godoctor \ | ||
github.com/rogpeppe/godef \ | ||
github.com/zmb3/gogetdoc \ | ||
github.com/fatih/gomodifytags \ | ||
github.com/mgechev/revive \ | ||
github.com/go-delve/delve/cmd/dlv" | ||
RUN mkdir -p /tmp/gotools \ | ||
&& cd /tmp/gotools \ | ||
&& export GOPATH=/tmp/gotools \ | ||
# Go tools w/module support | ||
&& export GO111MODULE=on \ | ||
&& (echo "${GO_TOOLS_WITH_MODULES}" | xargs -n 1 go get -x )2>&1 \ | ||
# gocode-gomod | ||
&& export GO111MODULE=auto \ | ||
&& go get -x -d github.com/stamblerre/gocode 2>&1 \ | ||
&& go build -o gocode-gomod github.com/stamblerre/gocode \ | ||
# golangci-lint | ||
&& curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b /usr/local/bin 2>&1 \ | ||
# Move Go tools into path and clean up | ||
&& mv /tmp/gotools/bin/* /usr/local/bin/ \ | ||
&& mv gocode-gomod /usr/local/bin/ \ | ||
&& rm -rf /tmp/gotools | ||
|
||
ENV GO111MODULE=auto | ||
|
||
RUN go get github.com/golang/protobuf/protoc-gen-go | ||
|
||
RUN apt-get update \ | ||
&& export DEBIAN_FRONTEND=noninteractive \ | ||
&& apt-get -y install --no-install-recommends protobuf-compiler docker.io |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -o nounset | ||
set -o errexit | ||
set -o pipefail | ||
|
||
readonly CMD=${1:-image} | ||
readonly IMAGE=cloudstateio/cloudstate-go-devcontainer:latest | ||
docker build . -t "$IMAGE" | ||
if [ "$CMD" == "push" ]; then | ||
docker push "$IMAGE" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"name": "Go", | ||
"image": "cloudstateio/cloudstate-go-devcontainer", | ||
"runArgs": [ | ||
"--cap-add=SYS_PTRACE", | ||
"--security-opt", | ||
"seccomp=unconfined", | ||
"-v", | ||
"/var/run/docker.sock:/var/run/docker.sock" | ||
], | ||
"settings": { | ||
"terminal.integrated.shell.linux": "/bin/bash", | ||
"go.gopath": "/go" | ||
}, | ||
"extensions": [ | ||
"golang.go" | ||
], | ||
"remoteUser": "vscode" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,22 @@ | ||
FROM golang:1.13.1-alpine3.10 | ||
FROM golang:1.14.4-alpine3.12 as builder | ||
|
||
RUN apk --no-cache add git | ||
RUN apk --no-cache add ca-certificates | ||
|
||
WORKDIR /go/src/app | ||
COPY . . | ||
|
||
# | ||
# -race and therefore CGO needs gcc, we don't want it to have in our build | ||
RUN CGO_ENABLED=0 go build -v -o tck_shoppingcart ./tck/cmd/tck_shoppingcart | ||
RUN CGO_ENABLED=0 go build -v -o tck_eventsourced ./tck/cmd/tck_eventsourced | ||
RUN go install -v ./... | ||
|
||
# | ||
# multistage – copy over the binary | ||
FROM alpine:latest | ||
RUN apk --no-cache add ca-certificates | ||
|
||
WORKDIR /root/ | ||
COPY --from=0 /go/bin/tck_shoppingcart . | ||
|
||
RUN mkdir -p /srv/ | ||
WORKDIR /srv | ||
COPY --from=builder /go/bin/tck_eventsourced . | ||
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ | ||
EXPOSE 8080 | ||
ENV HOST 0.0.0.0 | ||
ENV PORT 8080 | ||
|
||
CMD ["./tck_shoppingcart"] | ||
CMD ["./tck_eventsourced"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.