-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/gomoteserver: add files to build gomote server
This change adds files to build the gomote server. There is a small fix on a flag description in the actual gomote server itself. Updates golang/go#61912 For golang/go#61772 Change-Id: If424342975bf210cd27d8b18879210eac53ea8fb Reviewed-on: https://go-review.googlesource.com/c/build/+/520239 TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Run-TryBot: Carlos Amedee <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Auto-Submit: Carlos Amedee <[email protected]>
- Loading branch information
1 parent
82802b7
commit 1e72cea
Showing
3 changed files
with
72 additions
and
2 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,54 @@ | ||
# Copyright 2023 The Go Authors. All rights reserved. | ||
# Use of this source code is governed by a BSD-style | ||
# license that can be found in the LICENSE file. | ||
|
||
FROM golang:1.20-bookworm AS build | ||
LABEL maintainer="[email protected]" | ||
|
||
COPY go.mod /go/src/golang.org/x/build/go.mod | ||
COPY go.sum /go/src/golang.org/x/build/go.sum | ||
|
||
WORKDIR /go/src/golang.org/x/build | ||
|
||
# Download module dependencies to improve speed of re-building the | ||
# Docker image during minor code changes. | ||
RUN go mod download | ||
|
||
# Makefile passes a string with --build-arg version | ||
# This becomes part of the cache key for all subsequent instructions, | ||
# so it must not be placed above the "go mod download" command above. | ||
ARG version=unknown | ||
|
||
COPY . /go/src/golang.org/x/build/ | ||
|
||
RUN go install -ldflags "-X 'main.Version=$version'" golang.org/x/build/cmd/gomoteserver | ||
|
||
FROM debian:bookworm AS build_drawterm | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
git-core ca-certificates make gcc libc6-dev libx11-dev | ||
|
||
# drawterm connects to plan9 instances like: | ||
# echo glenda123 | ./drawterm -a <addr> -c <addr> -u glenda -k user=glenda | ||
# Where <addr> is the IP address of the Plan 9 instance on GCE, | ||
# "glenda" is the username and "glenda123" is the password. | ||
RUN git clone https://github.com/0intro/conterm /tmp/conterm && \ | ||
cd /tmp/conterm && \ | ||
CONF=unix make && mv /tmp/conterm/drawterm /usr/local/bin && \ | ||
rm -rf /tmp/conterm | ||
|
||
FROM debian:bookworm | ||
|
||
# openssh client is for the gomote ssh proxy client. | ||
# telnet is for the gomote ssh proxy to windows. (no ssh server there) | ||
RUN apt-get update && apt-get install -y \ | ||
--no-install-recommends \ | ||
ca-certificates \ | ||
openssh-client \ | ||
telnet \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
COPY --from=build /go/bin/gomoteserver / | ||
COPY --from=build_drawterm /usr/local/bin/drawterm /usr/local/bin/ | ||
|
||
ENTRYPOINT ["/gomoteserver"] |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/sh | ||
|
||
# Copyright 2023 The Go Authors. All rights reserved. | ||
# Use of this source code is governed by a BSD-style | ||
# license that can be found in the LICENSE file. | ||
|
||
VERSION=$(git rev-parse HEAD) | ||
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) | ||
if ! git diff-index HEAD --quiet || ! git diff-files --quiet; then | ||
VERSION=$VERSION-dirty | ||
dirty=1 | ||
fi | ||
if [ -n "$dirty" ] || [ -z "$(git config --get-all "branch.${CURRENT_BRANCH}.remote")" ] || [ -n "$(git rev-list '@{upstream}..HEAD')" ]; then | ||
VERSION=$VERSION-$USER-$(git show --quiet --pretty=%cI HEAD | perl -npe 's/[^\dT]//g;$_=substr($_,0,15)') | ||
fi | ||
echo "$VERSION" |