summaryrefslogtreecommitdiff
path: root/Dockerfile
diff options
context:
space:
mode:
authorAmir Zarrinkafsh <nightah@me.com>2021-09-16 22:39:18 +1000
committerGitHub <noreply@github.com>2021-09-16 22:39:18 +1000
commit92ec00d7c50813139b4a1dff32a681a655431248 (patch)
treeb216e0dfed637c4c2a9de130064829675937cab0 /Dockerfile
parente1ca24344a10d80160149987e4315de28ecf4837 (diff)
feat: builds with gox and buildx (#2381)
* feat: builds with gox and buildx This change builds all of Authelia respective binaries in parallel within a single step and distributes as necessary to subsequent steps, we now also build and distribute for the following OS/Architecture: freebsd/amd64. Our CI/CD pipeline now also utilises docker buildx as a default for builds and pushes. * refactor: clean up docker helper * Remove `authelia-scripts docker push-image` command as all pushes will be performed with buildx and manifests * Rename the --arch flag to --container * Add Dockerfile.dev for users that want to build an Authelia container from source without utilising suites * Set Dockerfile.dev as default for `authelia-scripts docker build` command * refactor: variant -> container
Diffstat (limited to 'Dockerfile')
-rw-r--r--Dockerfile47
1 files changed, 16 insertions, 31 deletions
diff --git a/Dockerfile b/Dockerfile
index 18289e04f..fe1ba6c29 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,47 +1,32 @@
-# =======================================
-# ===== Build image for the backend =====
-# =======================================
-FROM golang:1.17.1-alpine AS builder-backend
-
-WORKDIR /go/src/app
-
-COPY go.mod go.sum ./
-
-RUN \
-echo ">> Downloading go modules..." && \
-go mod download
-
-COPY / ./
-
-ARG LDFLAGS_EXTRA
-
-RUN \
-mv public_html internal/server/public_html && \
-chmod 0666 /go/src/app/.healthcheck.env && \
-echo ">> Starting go build..." && \
-GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -tags netgo \
--ldflags "-s -w ${LDFLAGS_EXTRA}" -trimpath -o authelia ./cmd/authelia
-
# ===================================
# ===== Authelia official image =====
# ===================================
FROM alpine:3.14.2
+ARG TARGETOS
+ARG TARGETARCH
+
WORKDIR /app
-RUN apk --no-cache add ca-certificates su-exec tzdata
+# Set environment variables
+ENV PATH="/app:${PATH}" \
+ PUID=0 \
+ PGID=0
+
+RUN \
+apk --no-cache add ca-certificates su-exec tzdata
+
+COPY LICENSE .healthcheck.env entrypoint.sh healthcheck.sh ./
+
+RUN \
+chmod 0666 /app/.healthcheck.env
-COPY --from=builder-backend /go/src/app/authelia /go/src/app/LICENSE /go/src/app/entrypoint.sh /go/src/app/healthcheck.sh /go/src/app/.healthcheck.env ./
+COPY authelia-${TARGETOS}-${TARGETARCH} ./authelia
EXPOSE 9091
VOLUME /config
-# Set environment variables
-ENV PATH="/app:${PATH}" \
- PUID=0 \
- PGID=0
-
ENTRYPOINT ["/app/entrypoint.sh"]
CMD ["--config", "/config/configuration.yml"]
HEALTHCHECK --interval=30s --timeout=3s --start-period=1m CMD /app/healthcheck.sh