mirror of
https://github.com/glauth/glauth.git
synced 2026-10-26 06:00:13 +00:00
Continued work on docker builds
This commit is contained in:
+44
-6
@@ -1,9 +1,47 @@
|
||||
FROM golang:latest
|
||||
#################
|
||||
# Build Step
|
||||
#################
|
||||
|
||||
FROM golang:latest as build
|
||||
|
||||
MAINTAINER Ben Yanke <ben@benyanke.com>
|
||||
|
||||
RUN mkdir /app
|
||||
ADD . /app/
|
||||
WORKDIR /app
|
||||
RUN go build -o main .
|
||||
CMD ["/app/main"]
|
||||
RUN mkdir /app /tmp/gocode
|
||||
ADD . /app/
|
||||
WORKDIR /app
|
||||
|
||||
# Required Envs for GO
|
||||
ENV GOPATH=/tmp/gocode
|
||||
|
||||
# Install deps
|
||||
RUN go get -d ./...
|
||||
|
||||
# Build
|
||||
# RUN rm -f /app/bin/glauth64 && GOOS=linux GOARCH=amd64 go build -o /app/bin/glauth64 glauth.go bindata.go ldapbackend.go webapi.go configbackend.go
|
||||
RUN GOOS=linux GOARCH=amd64 go build -o /app/bin/glauth64 glauth.go bindata.go ldapbackend.go webapi.go configbackend.go
|
||||
|
||||
# RUN for GOOS in darwin linux; do
|
||||
# for GOARCH in 386 amd64; do
|
||||
# go build -v -o /app/bin/glauth-$GOOS-$GOARCH
|
||||
# done
|
||||
# done
|
||||
|
||||
|
||||
|
||||
#################
|
||||
# Test Step
|
||||
#################
|
||||
|
||||
FROM golang:alpine as run
|
||||
|
||||
MAINTAINER Ben Yanke <ben@benyanke.com>
|
||||
|
||||
RUN apk --no-cache add ca-certificates
|
||||
|
||||
ADD sample-simple.cfg /app/sample-simple.cfg
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=build /app/bin/glauth64 /app/glauth64
|
||||
|
||||
# CMD /app/glauth64 -c /app/sample-simple.cfg
|
||||
CMD ["/app/glauth64", "-c", "/app/sample-simple.cfg"]
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
# Example file
|
||||
# https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds
|
||||
# docker build -t alexellis2/href-counter:latest .
|
||||
|
||||
|
||||
FROM golang:1.7.3
|
||||
WORKDIR /go/src/github.com/alexellis/href-counter/
|
||||
RUN go get -d -v golang.org/x/net/html
|
||||
COPY app.go .
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app .
|
||||
|
||||
FROM alpine:latest
|
||||
RUN apk --no-cache add ca-certificates
|
||||
WORKDIR /root/
|
||||
COPY --from=0 /go/src/github.com/alexellis/href-counter/app .
|
||||
CMD ["./app"]
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user