diff --git a/Dockerfile b/Dockerfile index ad573f80..12c67e5f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,8 +11,7 @@ RUN apk --no-cache add gcc musl-dev WORKDIR /go/src/app -COPY go.mod go.mod -COPY go.sum go.sum +COPY go.mod go.sum ./ RUN go mod download @@ -27,9 +26,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 -linkmode external -extldflags -static' -o authelia && cd ../../ -RUN cd cmd/authelia-scripts && GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -ldflags '-w -linkmode external -extldflags -static' -o authelia-scripts - +RUN cd cmd/authelia && \ +GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -tags netgo -ldflags '-w -linkmode external -extldflags -static' -o authelia && \ +cd ../authelia-scripts && \ +GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -ldflags '-w -linkmode external -extldflags -static' -o authelia-scripts # ======================================== # ===== Build image for the frontend ===== @@ -51,8 +51,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-backend /go/src/app/cmd/authelia/authelia /go/src/app/cmd/authelia-scripts/authelia-scripts ./ COPY --from=builder-frontend /node/src/app/build public_html EXPOSE 9091 diff --git a/Dockerfile.CI b/Dockerfile.CI index ec780af5..ac5580e0 100644 --- a/Dockerfile.CI +++ b/Dockerfile.CI @@ -7,8 +7,7 @@ RUN apk --no-cache add ca-certificates tzdata WORKDIR /usr/app -COPY /dist/authelia authelia -COPY /dist/public_html public_html +COPY dist ./ EXPOSE 9091 diff --git a/Dockerfile.arm32v7 b/Dockerfile.arm32v7 index 7f15f3df..5d901127 100644 --- a/Dockerfile.arm32v7 +++ b/Dockerfile.arm32v7 @@ -14,8 +14,7 @@ RUN apk --no-cache add curl && \ WORKDIR /go/src/app -COPY go.mod go.mod -COPY go.sum go.sum +COPY go.mod go.sum ./ RUN go mod download @@ -30,8 +29,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 CC=arm-linux-musleabihf-gcc go build -tags netgo -ldflags '-w -linkmode external -extldflags -static' -o authelia && cd ../../ -RUN cd cmd/authelia-scripts && GOOS=linux GOARCH=arm CGO_ENABLED=1 CC=arm-linux-musleabihf-gcc go build -ldflags '-w -linkmode external -extldflags -static' -o authelia-scripts +RUN cd cmd/authelia && \ +GOOS=linux GOARCH=arm CGO_ENABLED=1 CC=arm-linux-musleabihf-gcc go build -tags netgo -ldflags '-w -linkmode external -extldflags -static' -o authelia && \ +cd ../authelia-scripts && \ +GOOS=linux GOARCH=arm CGO_ENABLED=1 CC=arm-linux-musleabihf-gcc go build -ldflags '-w -linkmode external -extldflags -static' -o authelia-scripts # ======================================== @@ -57,8 +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-backend /go/src/app/cmd/authelia/authelia /go/src/app/cmd/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 c383e2c6..2f7ea06b 100644 --- a/Dockerfile.arm64v8 +++ b/Dockerfile.arm64v8 @@ -14,8 +14,7 @@ RUN apk --no-cache add curl && \ WORKDIR /go/src/app -COPY go.mod go.mod -COPY go.sum go.sum +COPY go.mod go.sum ./ RUN go mod download @@ -30,8 +29,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 CC=aarch64-linux-musl-gcc go build -tags netgo -ldflags '-w -linkmode external -extldflags -static' -o authelia && cd ../../ -RUN cd cmd/authelia-scripts && GOOS=linux GOARCH=arm64 CGO_ENABLED=1 CC=aarch64-linux-musl-gcc go build -ldflags '-w -linkmode external -extldflags -static' -o authelia-scripts +RUN cd cmd/authelia && \ +GOOS=linux GOARCH=arm64 CGO_ENABLED=1 CC=aarch64-linux-musl-gcc go build -tags netgo -ldflags '-w -linkmode external -extldflags -static' -o authelia && \ +cd ../authelia-scripts && \ +GOOS=linux GOARCH=arm64 CGO_ENABLED=1 CC=aarch64-linux-musl-gcc go build -ldflags '-w -linkmode external -extldflags -static' -o authelia-scripts # ======================================== @@ -57,8 +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-backend /go/src/app/cmd/authelia/authelia /go/src/app/cmd/authelia-scripts/authelia-scripts ./ COPY --from=builder-frontend /node/src/app/build public_html EXPOSE 9091