mirror of
https://github.com/glauth/glauth.git
synced 2026-10-26 06:00:13 +00:00
Basic example of docker build and run works - see build.sh for now
This commit is contained in:
+19
-19
@@ -3,45 +3,45 @@
|
||||
#################
|
||||
|
||||
FROM golang:latest as build
|
||||
|
||||
MAINTAINER Ben Yanke <ben@benyanke.com>
|
||||
|
||||
# Setup work env
|
||||
RUN mkdir /app /tmp/gocode
|
||||
ADD . /app/
|
||||
WORKDIR /app
|
||||
|
||||
# Required Envs for GO
|
||||
# Required envs for GO
|
||||
ENV GOPATH=/tmp/gocode
|
||||
ENV GOOS=linux
|
||||
ENV GOARCH=amd64
|
||||
|
||||
# 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
|
||||
|
||||
|
||||
RUN go build -o /app/glauth glauth.go bindata.go ldapbackend.go webapi.go configbackend.go
|
||||
|
||||
#################
|
||||
# Test Step
|
||||
#################
|
||||
|
||||
FROM golang:alpine as run
|
||||
# TBD
|
||||
|
||||
#################
|
||||
# Run Step
|
||||
#################
|
||||
|
||||
FROM golang:latest as run
|
||||
MAINTAINER Ben Yanke <ben@benyanke.com>
|
||||
|
||||
RUN apk --no-cache add ca-certificates
|
||||
# Copies a sample config to be used if a volume isn't mounted with user's config
|
||||
ADD sample-simple.cfg /app/config/config.cfg
|
||||
|
||||
ADD sample-simple.cfg /app/sample-simple.cfg
|
||||
WORKDIR /app
|
||||
# Copy binary from build container
|
||||
COPY --from=build /app/glauth /app/glauth
|
||||
|
||||
COPY --from=build /app/bin/glauth64 /app/glauth64
|
||||
# Expose web and LDAP ports
|
||||
EXPOSE 389 5555
|
||||
|
||||
# CMD /app/glauth64 -c /app/sample-simple.cfg
|
||||
CMD ["/app/glauth64", "-c", "/app/sample-simple.cfg"]
|
||||
# To use your own config, mount /app/config, and place config.cfg in mounted volume
|
||||
CMD ["/app/glauth", "-c", "/app/config/config.cfg"]
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
FROM frolvlad/alpine-glibc:latest
|
||||
MAINTAINER Ben Yanke <ben@benyanke.com>
|
||||
|
||||
RUN apk add --update git \
|
||||
&& mkdir /data /app \
|
||||
&& cd /tmp \
|
||||
&& git clone https://github.com/nmcclain/glauth /tmp/glauth \
|
||||
&& cp /tmp/glauth/bin/glauth64 /app/glauth64 \
|
||||
&& mkdir /app/config \
|
||||
&& cp /tmp/glauth/sample-simple.cfg /app/config/config.cfg \
|
||||
&& cp /tmp/glauth/sample-simple.cfg /tmp/config.backup.cfg \
|
||||
&& rm -Rf /tmp/glauth
|
||||
|
||||
COPY start.sh /app/start.sh
|
||||
RUN chmod +x /app/start.sh
|
||||
|
||||
EXPOSE 389 5555
|
||||
|
||||
VOLUME [ "/app/config" ]
|
||||
CMD [ "/bin/sh", "/app/start.sh" ]
|
||||
@@ -1,16 +0,0 @@
|
||||
# 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"]
|
||||
Reference in New Issue
Block a user