2021-12-24 22:25:38 +00:00
|
|
|
# Stage 1: Build website
|
2022-04-25 10:30:08 +00:00
|
|
|
FROM --platform=${BUILDPLATFORM} docker.io/node:18 as website-builder
|
2021-07-13 09:06:51 +00:00
|
|
|
|
2021-11-26 13:19:57 +00:00
|
|
|
COPY ./website /work/website/
|
2022-07-31 16:10:21 +00:00
|
|
|
COPY ./blueprints /work/blueprints/
|
2021-07-13 09:06:51 +00:00
|
|
|
|
|
|
|
ENV NODE_ENV=production
|
2022-05-07 19:22:33 +00:00
|
|
|
WORKDIR /work/website
|
|
|
|
RUN npm ci && npm run build-docs-only
|
2021-07-13 09:06:51 +00:00
|
|
|
|
2021-12-24 22:25:38 +00:00
|
|
|
# Stage 2: Build webui
|
2022-04-25 10:30:08 +00:00
|
|
|
FROM --platform=${BUILDPLATFORM} docker.io/node:18 as web-builder
|
2021-05-02 22:49:16 +00:00
|
|
|
|
2021-11-26 13:19:57 +00:00
|
|
|
COPY ./web /work/web/
|
|
|
|
COPY ./website /work/website/
|
2021-05-02 22:49:16 +00:00
|
|
|
|
|
|
|
ENV NODE_ENV=production
|
2022-05-07 19:22:33 +00:00
|
|
|
WORKDIR /work/web
|
|
|
|
RUN npm ci && npm run build
|
2021-05-02 22:49:16 +00:00
|
|
|
|
2022-05-07 19:22:33 +00:00
|
|
|
# Stage 3: Poetry to requirements.txt export
|
2022-08-05 06:37:14 +00:00
|
|
|
FROM docker.io/python:3.10.6-slim-bullseye AS poetry-locker
|
2022-05-07 19:22:33 +00:00
|
|
|
|
|
|
|
WORKDIR /work
|
|
|
|
COPY ./pyproject.toml /work
|
|
|
|
COPY ./poetry.lock /work
|
|
|
|
|
|
|
|
RUN pip install --no-cache-dir poetry && \
|
|
|
|
poetry export -f requirements.txt --output requirements.txt && \
|
|
|
|
poetry export -f requirements.txt --dev --output requirements-dev.txt
|
|
|
|
|
|
|
|
# Stage 4: Build go proxy
|
2022-08-03 07:10:23 +00:00
|
|
|
FROM docker.io/golang:1.19.0-bullseye AS builder
|
2021-05-02 22:49:16 +00:00
|
|
|
|
|
|
|
WORKDIR /work
|
|
|
|
|
2021-11-26 13:19:57 +00:00
|
|
|
COPY --from=web-builder /work/web/robots.txt /work/web/robots.txt
|
|
|
|
COPY --from=web-builder /work/web/security.txt /work/web/security.txt
|
2021-05-02 22:49:16 +00:00
|
|
|
|
|
|
|
COPY ./cmd /work/cmd
|
|
|
|
COPY ./web/static.go /work/web/static.go
|
|
|
|
COPY ./internal /work/internal
|
|
|
|
COPY ./go.mod /work/go.mod
|
|
|
|
COPY ./go.sum /work/go.sum
|
|
|
|
|
|
|
|
RUN go build -o /work/authentik ./cmd/server/main.go
|
|
|
|
|
2022-05-07 19:22:33 +00:00
|
|
|
# Stage 5: Run
|
2022-08-05 06:37:14 +00:00
|
|
|
FROM docker.io/python:3.10.6-slim-bullseye
|
2019-12-30 09:34:31 +00:00
|
|
|
|
2021-12-30 15:33:13 +00:00
|
|
|
LABEL org.opencontainers.image.url https://goauthentik.io
|
|
|
|
LABEL org.opencontainers.image.description goauthentik.io Main server image, see https://goauthentik.io for more info.
|
|
|
|
LABEL org.opencontainers.image.source https://github.com/goauthentik/authentik
|
|
|
|
|
2020-09-09 22:14:59 +00:00
|
|
|
WORKDIR /
|
2019-12-30 09:34:31 +00:00
|
|
|
|
2021-03-16 13:42:01 +00:00
|
|
|
ARG GIT_BUILD_HASH
|
|
|
|
ENV GIT_BUILD_HASH=$GIT_BUILD_HASH
|
|
|
|
|
2022-05-07 19:22:33 +00:00
|
|
|
COPY --from=poetry-locker /work/requirements.txt /
|
|
|
|
COPY --from=poetry-locker /work/requirements-dev.txt /
|
2021-12-24 22:25:38 +00:00
|
|
|
|
2019-12-30 09:34:31 +00:00
|
|
|
RUN apt-get update && \
|
2022-05-07 19:22:33 +00:00
|
|
|
# Required for installing pip packages
|
|
|
|
apt-get install -y --no-install-recommends build-essential pkg-config libxmlsec1-dev && \
|
|
|
|
# Required for runtime
|
|
|
|
apt-get install -y --no-install-recommends libxmlsec1-openssl libmaxminddb0 && \
|
2022-05-20 22:49:15 +00:00
|
|
|
# Required for bootstrap & healtcheck
|
|
|
|
apt-get install -y --no-install-recommends curl runit && \
|
2022-05-07 19:22:33 +00:00
|
|
|
pip install --no-cache-dir -r /requirements.txt && \
|
|
|
|
apt-get remove --purge -y build-essential pkg-config libxmlsec1-dev && \
|
2020-09-27 19:07:29 +00:00
|
|
|
apt-get autoremove --purge -y && \
|
2021-05-09 22:38:58 +00:00
|
|
|
apt-get clean && \
|
|
|
|
rm -rf /tmp/* /var/lib/apt/lists/* /var/tmp/ && \
|
2020-12-05 21:08:42 +00:00
|
|
|
adduser --system --no-create-home --uid 1000 --group --home /authentik authentik && \
|
2022-08-01 21:05:58 +00:00
|
|
|
mkdir -p /certs /media /blueprints && \
|
2021-12-25 18:18:47 +00:00
|
|
|
mkdir -p /authentik/.ssh && \
|
2022-03-09 20:56:18 +00:00
|
|
|
chown authentik:authentik /certs /media /authentik/.ssh
|
2019-02-11 17:01:29 +00:00
|
|
|
|
2021-06-09 14:04:17 +00:00
|
|
|
COPY ./authentik/ /authentik
|
|
|
|
COPY ./pyproject.toml /
|
|
|
|
COPY ./xml /xml
|
|
|
|
COPY ./tests /tests
|
|
|
|
COPY ./manage.py /
|
2022-08-01 21:05:58 +00:00
|
|
|
COPY ./blueprints/default /blueprints/default
|
|
|
|
COPY ./blueprints/system /blueprints/system
|
2021-06-09 14:04:17 +00:00
|
|
|
COPY ./lifecycle/ /lifecycle
|
2021-05-02 22:49:16 +00:00
|
|
|
COPY --from=builder /work/authentik /authentik-proxy
|
2021-12-01 20:25:01 +00:00
|
|
|
COPY --from=web-builder /work/web/dist/ /web/dist/
|
|
|
|
COPY --from=web-builder /work/web/authentik/ /web/authentik/
|
|
|
|
COPY --from=website-builder /work/website/help/ /website/help/
|
2019-10-07 19:23:38 +00:00
|
|
|
|
2022-07-30 20:41:29 +00:00
|
|
|
USER 1000
|
2021-10-05 18:45:18 +00:00
|
|
|
|
2020-11-18 23:53:33 +00:00
|
|
|
ENV TMPDIR /dev/shm/
|
2021-09-14 10:06:47 +00:00
|
|
|
ENV PYTHONUNBUFFERED 1
|
2021-08-23 12:54:02 +00:00
|
|
|
ENV PATH "/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/lifecycle"
|
2021-10-05 18:45:18 +00:00
|
|
|
|
2021-10-06 07:18:01 +00:00
|
|
|
HEALTHCHECK --interval=30s --timeout=30s --start-period=60s --retries=3 CMD [ "/lifecycle/ak", "healthcheck" ]
|
2021-10-05 18:45:18 +00:00
|
|
|
|
2022-07-30 20:41:29 +00:00
|
|
|
ENTRYPOINT [ "/usr/local/bin/dumb-init", "--", "/lifecycle/ak" ]
|