Skip to content
Permalink
Browse files
Last fix to build system for generic template
  • Loading branch information
antoniomika committed Jun 12, 2020
1 parent 3ceb6a2 commit 0a3bc58473d2b4b2c2626f4eca0027aa111355d2
Showing 12 changed files with 18 additions and 18 deletions.
@@ -4,6 +4,7 @@
/.git/
/.github/
/.gitignore
/.goreleaser.yml
/deploy/
!/deploy/ssl/.gitkeep
!/deploy/keys/.gitkeep
@@ -12,4 +13,4 @@
/sish
/.vscode/
/__debug_bin
/.DS_Store
/.DS_Store
@@ -9,7 +9,7 @@ jobs:
- uses: actions/checkout@v1
- name: Lint the codebase
run: |
docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:v1.27.0 golangci-lint run -E goimports
docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:v1.27.0 golangci-lint run -E goimports -E godot
- name: Set up Docker Buildx
uses: crazy-max/ghaction-docker-buildx@v1
with:
@@ -9,7 +9,7 @@ jobs:
- uses: actions/checkout@v1
- name: Lint the codebase
run: |
docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:v1.27.0 golangci-lint run -E goimports
docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:v1.27.0 golangci-lint run -E goimports -E godot
- name: Build and the Docker images
run: |
DATE="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
@@ -19,4 +19,4 @@ jobs:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -1,4 +1,4 @@
deploy/
dist/
sish
__debug_bin
__debug_bin
@@ -1,6 +1,5 @@
before:
hooks:
- go mod tidy
- go test ./...
- go generate ./...
builds:
@@ -7,13 +7,12 @@ ENV CGO_ENABLED 0

WORKDIR /app

RUN mkdir -p /gocache /gotmpdir
RUN mkdir -p /gocache /gotmpdir /emptydir
RUN apk add --no-cache git ca-certificates

COPY go.mod .
COPY go.sum .

RUN go mod tidy
RUN go mod download

COPY . .
@@ -26,14 +25,15 @@ RUN go generate ./...
RUN go test ./...
RUN go install -ldflags="-s -w -X github.com/antoniomika/sish/cmd.Version=${VERSION} -X github.com/antoniomika/sish/cmd.Commit=${COMMIT} -X github.com/antoniomika/sish/cmd.Date=${DATE}"

FROM scratch
FROM alpine
LABEL maintainer="Antonio Mika <me@antoniomika.me>"

WORKDIR /app

COPY --from=builder /tmp /tmp
COPY --from=builder /emptydir /tmp
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /app/deploy/ /app/deploy/
COPY --from=builder /app/README* /app/LICENSE* /app/
COPY --from=builder /app/templates /app/templates
COPY --from=builder /go/bin/sish /app/sish

@@ -7,13 +7,12 @@ ENV CGO_ENABLED 0

WORKDIR /app

RUN mkdir -p /gocache /gotmpdir
RUN mkdir -p /gocache /gotmpdir /emptydir
RUN apk add --no-cache git ca-certificates

COPY go.mod .
COPY go.sum .

RUN go mod tidy
RUN go mod download

COPY . .
@@ -36,9 +35,10 @@ LABEL maintainer="Antonio Mika <me@antoniomika.me>"

WORKDIR /app

COPY --from=builder /tmp /tmp
COPY --from=builder /emptydir /tmp
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /app/deploy/ /app/deploy/
COPY --from=builder /app/README* /app/LICENSE* /app/
COPY --from=builder /app/templates /app/templates
COPY --from=builder /go/bin/sish /app/sish

@@ -14,4 +14,4 @@ profiles:
provider: cloudflare
provider_options:
auth_token: AUTH_TOKEN
auth_username: AUTH_EMAIL
auth_username: AUTH_EMAIL
@@ -2,4 +2,4 @@
</div>
</body>
</html>
{{ end }}
{{ end }}
@@ -13,7 +13,7 @@ import (

// SSHConnection handles state for a SSHConnection. It wraps an ssh.ServerConn
// and allows us to pass other state around the application.
// Listeners is a map[string]net.Listener
// Listeners is a map[string]net.Listener.
type SSHConnection struct {
SSHConn *ssh.ServerConn
Listeners *sync.Map
@@ -63,7 +63,7 @@ type IdleTimeoutConn struct {
Conn net.Conn
}

// Read is needed to implement the reader part
// Read is needed to implement the reader part.
func (i IdleTimeoutConn) Read(buf []byte) (int, error) {
err := i.Conn.SetReadDeadline(time.Now().Add(viper.GetDuration("idle-connection-timeout")))
if err != nil {
@@ -98,7 +98,7 @@ func (c *WebConsole) HandleTemplate(hostname string, hostIsRoot bool, userIsAdmi
}
}

// HandleWebSocket handles the websocket route
// HandleWebSocket handles the websocket route.
func (c *WebConsole) HandleWebSocket(hostname string, g *gin.Context) {
conn, err := upgrader.Upgrade(g.Writer, g.Request, nil)
if err != nil {

0 comments on commit 0a3bc58

Please sign in to comment.