From 511b0b3c62a1c6bec13ee063f1c9cfbeb352f8fe Mon Sep 17 00:00:00 2001 From: Mike Kusold Date: Mon, 23 Dec 2019 20:23:02 -0700 Subject: [PATCH] Distribute authelia-scripts in docker image Building and copying the authelia-scripts binary so that migrations can easily be ran. --- Dockerfile | 6 +++++- Dockerfile.arm32v7 | 6 +++++- Dockerfile.arm64v8 | 6 +++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index c5f15659..5df4b842 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,7 +27,10 @@ RUN echo "Write tag ${BUILD_TAG} and commit ${BUILD_COMMIT} in binary." && \ sed -i "s/__BUILD_TIME__/${BUILD_TIME}/" cmd/authelia/constants.go # CGO_ENABLED=1 is mandatory for building go-sqlite3 -RUN cd cmd/authelia && GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -tags netgo -ldflags '-w' -o authelia +RUN cd cmd/authelia && GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -tags netgo -ldflags '-w' -o authelia && cd ../../ + +# CGO_ENABLED=1 is mandatory for building go-sqlite3 +RUN cd cmd/authelia-scripts && GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -o authelia-scripts # ======================================== @@ -51,6 +54,7 @@ RUN apk --no-cache add ca-certificates tzdata WORKDIR /usr/app COPY --from=builder-backend /go/src/app/cmd/authelia/authelia authelia +COPY --from=builder-backend /go/src/app/cmd/authelia-scripts/authelia-scripts authelia-scripts COPY --from=builder-frontend /node/src/app/build public_html EXPOSE 9091 diff --git a/Dockerfile.arm32v7 b/Dockerfile.arm32v7 index 3e78508b..01fa4106 100644 --- a/Dockerfile.arm32v7 +++ b/Dockerfile.arm32v7 @@ -28,7 +28,10 @@ RUN echo "Write tag ${BUILD_TAG} and commit ${BUILD_COMMIT} in binary." && \ sed -i "s/__BUILD_TIME__/${BUILD_TIME}/" cmd/authelia/constants.go # CGO_ENABLED=1 is mandatory for building go-sqlite3 -RUN cd cmd/authelia && GOOS=linux GOARCH=arm CGO_ENABLED=1 go build -tags netgo -ldflags '-w' -o authelia +RUN cd cmd/authelia && GOOS=linux GOARCH=arm CGO_ENABLED=1 go build -tags netgo -ldflags '-w' -o authelia && cd ../../ + +# CGO_ENABLED=1 is mandatory for building go-sqlite3 +RUN cd cmd/authelia-scripts && GOOS=linux GOARCH=arm CGO_ENABLED=1 go build -o authelia-scripts # ======================================== @@ -55,6 +58,7 @@ RUN apk --no-cache add ca-certificates tzdata && \ WORKDIR /usr/app COPY --from=builder-backend /go/src/app/cmd/authelia/authelia authelia +COPY --from=builder-backend /go/src/app/cmd/authelia-scripts/authelia-scripts authelia-scripts COPY --from=builder-frontend /node/src/app/build public_html EXPOSE 9091 diff --git a/Dockerfile.arm64v8 b/Dockerfile.arm64v8 index da11d2c2..fc3da912 100644 --- a/Dockerfile.arm64v8 +++ b/Dockerfile.arm64v8 @@ -28,7 +28,10 @@ RUN echo "Write tag ${BUILD_TAG} and commit ${BUILD_COMMIT} in binary." && \ sed -i "s/__BUILD_TIME__/${BUILD_TIME}/" cmd/authelia/constants.go # CGO_ENABLED=1 is mandatory for building go-sqlite3 -RUN cd cmd/authelia && GOOS=linux GOARCH=arm64 CGO_ENABLED=1 go build -tags netgo -ldflags '-w' -o authelia +RUN cd cmd/authelia && GOOS=linux GOARCH=arm64 CGO_ENABLED=1 go build -tags netgo -ldflags '-w' -o authelia && cd ../../ + +# CGO_ENABLED=1 is mandatory for building go-sqlite3 +RUN cd cmd/authelia-scripts && GOOS=linux GOARCH=arm64 CGO_ENABLED=1 go build -o authelia-scripts # ======================================== @@ -55,6 +58,7 @@ RUN apk --no-cache add ca-certificates tzdata && \ WORKDIR /usr/app COPY --from=builder-backend /go/src/app/cmd/authelia/authelia authelia +COPY --from=builder-backend /go/src/app/cmd/authelia-scripts/authelia-scripts authelia-scripts COPY --from=builder-frontend /node/src/app/build public_html EXPOSE 9091