mirror of
https://github.com/glauth/glauth.git
synced 2026-10-25 05:30:47 +00:00
2b45aefd74
- Moving from Travis CI to GitHub Actions
65 lines
2.0 KiB
Plaintext
65 lines
2.0 KiB
Plaintext
#################
|
|
# Build Step
|
|
#################
|
|
|
|
FROM golang:alpine as build
|
|
LABEL maintainers="Ben Yanke <ben@benyanke.com>, Jörn Friedrich Dreyer <jfd@butonic.de>, Chris F Ravenscroft <chris@voilaweb.com>"
|
|
|
|
# Setup work env
|
|
RUN mkdir /app /tmp/gocode
|
|
ADD . /app/
|
|
WORKDIR /app
|
|
|
|
|
|
# Required envs for GO
|
|
ENV GOPATH=/tmp/gocode
|
|
ENV GOOS=linux
|
|
ENV GOARCH=amd64
|
|
ENV CGO_ENABLED=1
|
|
|
|
# Only needed for alpine builds
|
|
RUN apk add --no-cache git make go-bindata alpine-sdk
|
|
|
|
# Run go-bindata to embed data for API
|
|
RUN go-bindata -pkg=assets -o=pkg/assets/bindata.go assets
|
|
RUN gofmt -w pkg/assets/bindata.go
|
|
|
|
# Install deps
|
|
RUN go get -d -v ./...
|
|
|
|
# Build and copy final result
|
|
RUN uname -a
|
|
RUN if [ $(uname -m) == x86_64 ]; then make linux64 && cp ./bin/glauth64 /app/glauth; export PLUGIN_OS=linux PLUGIN_ARCH=amd64; make bin/sqlite.so bin/postgres.so bin/mysql.so; cp ./bin/*.so /app/; fi
|
|
RUN if [ $(uname -m) == aarch64 ]; then make linuxarm64 && cp ./bin/glauth-arm64 /app/glauth; export PLUGIN_OS=linux PLUGIN_ARCH=arm64; make bin/sqlite.so bin/postgres.so bin/mysql.so; cp ./bin/*.so /app/; fi
|
|
|
|
# Check glauth works
|
|
RUN /app/glauth --version
|
|
|
|
#################
|
|
# Run Step
|
|
#################
|
|
|
|
FROM alpine as run
|
|
LABEL maintainers="Ben Yanke <ben@benyanke.com>, Jörn Friedrich Dreyer <jfd@butonic.de>, Chris F Ravenscroft <chris@voilaweb.com>"
|
|
|
|
# Copy binary from build container
|
|
COPY --from=build /app/glauth /app/glauth
|
|
COPY --from=build /app/*.so /app/
|
|
|
|
# Copy docker specific scripts from build container
|
|
COPY --from=build /app/scripts/docker/start-plugins.sh /app/docker/
|
|
COPY --from=build /app/scripts/docker/default-config-plugins.cfg /app/docker/
|
|
COPY --from=build /app/scripts/docker/gl.db /app/docker/
|
|
|
|
# Install ldapsearch for container health checks, then ensure ldapsearch is installed
|
|
RUN apk update && apk add --no-cache dumb-init openldap-clients && which ldapsearch && rm -rf /var/cache/apk/*
|
|
|
|
# Install init
|
|
|
|
# Expose web and LDAP ports
|
|
EXPOSE 389 636 5555
|
|
|
|
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
|
CMD ["/bin/sh", "/app/docker/start-plugins.sh"]
|
|
|