Merge pull request #17 from halverneus/dev

Package manager and package updates
pull/19/head v1.5.1
Jeromy Streets 6 years ago committed by GitHub
commit 55d0d78aed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      .dockerignore
  2. 28
      Dockerfile
  3. 26
      Dockerfile.all
  4. 17
      Gopkg.lock
  5. 34
      Gopkg.toml
  6. 21
      cli/version/version.go
  7. 7
      go.mod
  8. 10
      go.sum

@ -1,5 +1,6 @@
.git
.gitignore
Dockerfile
Dockerfile.all
LICENSE
README.md

@ -1,24 +1,28 @@
FROM golang:1.11.2 as builder
FROM golang:1.11.3 as builder
EXPOSE 8080
ENV BUILD_DIR /go/src/github.com/halverneus/static-file-server
ENV MAIN github.com/halverneus/static-file-server/bin/serve
ENV DEP_VERSION v0.5.0
RUN curl -fsSL -o /usr/local/bin/dep \
https://github.com/golang/dep/releases/download/$DEP_VERSION/dep-linux-amd64 && \
chmod +x /usr/local/bin/dep
ENV VERSION 1.5.1
ENV BUILD_DIR /build
RUN mkdir -p ${BUILD_DIR}
WORKDIR ${BUILD_DIR}
COPY go.* ./
RUN go mod download
COPY . .
RUN dep ensure -vendor-only
RUN go test -race -cover ./...
RUN CGO_ENABLED=0 go build -a -installsuffix cgo -o /serve ${MAIN}
RUN go test -cover ./...
RUN CGO_ENABLED=0 go build -a -tags netgo -installsuffix netgo -ldflags "-X github.com/halverneus/static-file-server/cli/version.version=${VERSION}" -o /serve /build/bin/serve
FROM scratch
COPY --from=builder /serve /
ENTRYPOINT ["/serve"]
CMD []
# Metadata
LABEL life.apets.vendor="Halverneus" \
life.apets.url="https://github.com/halverneus/static-file-server" \
life.apets.name="Static File Server" \
life.apets.description="A tiny static file server" \
life.apets.version="v1.5.1" \
life.apets.schema-version="1.0"

@ -0,0 +1,26 @@
FROM golang:1.11.3 as builder
EXPOSE 8080
ENV VERSION 1.5.1
ENV BUILD_DIR /build
RUN mkdir -p ${BUILD_DIR}
WORKDIR ${BUILD_DIR}
COPY . .
RUN go test -race -cover ./...
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -tags netgo -installsuffix netgo -ldflags "-X github.com/halverneus/static-file-server/cli/version.version=${VERSION}" -o pkg/linux-amd64/serve /build/bin/serve
RUN CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -a -tags netgo -installsuffix netgo -ldflags "-X github.com/halverneus/static-file-server/cli/version.version=${VERSION}" -o pkg/linux-i386/serve /build/bin/serve
RUN CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -a -tags netgo -installsuffix netgo -ldflags "-X github.com/halverneus/static-file-server/cli/version.version=${VERSION}" -o pkg/linux-arm6/serve /build/bin/serve
RUN CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 go build -a -tags netgo -installsuffix netgo -ldflags "-X github.com/halverneus/static-file-server/cli/version.version=${VERSION}" -o pkg/linux-arm7/serve /build/bin/serve
RUN CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -a -tags netgo -installsuffix netgo -ldflags "-X github.com/halverneus/static-file-server/cli/version.version=${VERSION}" -o pkg/linux-arm64/serve /build/bin/serve
RUN CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -a -tags netgo -installsuffix netgo -ldflags "-X github.com/halverneus/static-file-server/cli/version.version=${VERSION}" -o pkg/darwin-amd64/serve /build/bin/serve
RUN CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -a -tags netgo -installsuffix netgo -ldflags "-X github.com/halverneus/static-file-server/cli/version.version=${VERSION}" -o pkg/win-amd64/serve.exe /build/bin/serve
# Metadata
LABEL life.apets.vendor="Halverneus" \
life.apets.url="https://github.com/halverneus/static-file-server" \
life.apets.name="Static File Server" \
life.apets.description="A tiny static file server" \
life.apets.version="v1.5.1" \
life.apets.schema-version="1.0"

17
Gopkg.lock generated

@ -1,17 +0,0 @@
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
[[projects]]
digest = "1:342378ac4dcb378a5448dd723f0784ae519383532f5e70ade24132c4c8693202"
name = "gopkg.in/yaml.v2"
packages = ["."]
pruneopts = "UT"
revision = "5420a8b6744d3b0345ab293f6fcba19c978f1183"
version = "v2.2.1"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
input-imports = ["gopkg.in/yaml.v2"]
solver-name = "gps-cdcl"
solver-version = 1

@ -1,34 +0,0 @@
# Gopkg.toml example
#
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]
# name = "github.com/user/project"
# version = "1.0.0"
#
# [[constraint]]
# name = "github.com/user/project2"
# branch = "dev"
# source = "github.com/myfork/project2"
#
# [[override]]
# name = "github.com/x/y"
# version = "2.4.0"
#
# [prune]
# non-go = false
# go-tests = true
# unused-packages = true
[[constraint]]
name = "gopkg.in/yaml.v2"
version = "2.2.1"
[prune]
go-tests = true
unused-packages = true

@ -7,27 +7,16 @@ import (
// Run print operation.
func Run() error {
fmt.Printf("%s\n%s\n", Text, GoVersionText)
fmt.Printf("%s\n%s\n", VersionText, GoVersionText)
return nil
}
var (
// MajorVersion of static-file-server.
MajorVersion = 1
// version is the application version set during build.
version string
// MinorVersion of static-file-server.
MinorVersion = 5
// FixVersion of static-file-server.
FixVersion = 0
// Text for directly accessing the static-file-server version.
Text = fmt.Sprintf(
"v%d.%d.%d",
MajorVersion,
MinorVersion,
FixVersion,
)
// VersionText for directly accessing the static-file-server version.
VersionText = fmt.Sprintf("v%s", version)
// GoVersionText for directly accessing the version of the Go runtime
// compiled with the static-file-server.

@ -0,0 +1,7 @@
module github.com/halverneus/static-file-server
require (
github.com/kr/pretty v0.1.0 // indirect
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
gopkg.in/yaml.v2 v2.2.2
)

@ -0,0 +1,10 @@
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
Loading…
Cancel
Save