Converted to go modules so it can be easily built on armh

This commit is contained in:
Zach Brown 2018-12-20 09:23:52 -05:00
parent c6136a5aa2
commit 1a45326c96
5 changed files with 10 additions and 64 deletions

View File

@ -1,22 +1,13 @@
FROM golang:1.11.2 as builder
FROM golang:1.11 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
RUN mkdir -p ${BUILD_DIR}
WORKDIR ${BUILD_DIR}
RUN mkdir -p /build
WORKDIR /build
COPY . .
RUN dep ensure -vendor-only
RUN go test -race -cover ./...
RUN CGO_ENABLED=0 go build -a -installsuffix cgo -o /serve ${MAIN}
RUN CGO_ENABLED=0 go build -a -installsuffix cgo -o /serve /build/bin/serve
FROM scratch
COPY --from=builder /serve /

17
Gopkg.lock generated
View File

@ -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

View File

@ -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

3
go.mod Normal file
View File

@ -0,0 +1,3 @@
module github.com/halverneus/static-file-server
require gopkg.in/yaml.v2 v2.2.1

3
go.sum Normal file
View File

@ -0,0 +1,3 @@
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=