root: export poetry deps to requirements.txt so we don't need poetry … (#2823)
* root: export poetry deps to requirements.txt so we don't need poetry installed, removed packages we don't need anymore Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> * update docs Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
03d5b9e7e9
commit
a7a7b5aacb
42
Dockerfile
42
Dockerfile
|
@ -4,7 +4,8 @@ FROM --platform=${BUILDPLATFORM} docker.io/node:18 as website-builder
|
||||||
COPY ./website /work/website/
|
COPY ./website /work/website/
|
||||||
|
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
RUN cd /work/website && npm ci && npm run build-docs-only
|
WORKDIR /work/website
|
||||||
|
RUN npm ci && npm run build-docs-only
|
||||||
|
|
||||||
# Stage 2: Build webui
|
# Stage 2: Build webui
|
||||||
FROM --platform=${BUILDPLATFORM} docker.io/node:18 as web-builder
|
FROM --platform=${BUILDPLATFORM} docker.io/node:18 as web-builder
|
||||||
|
@ -13,9 +14,21 @@ COPY ./web /work/web/
|
||||||
COPY ./website /work/website/
|
COPY ./website /work/website/
|
||||||
|
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
RUN cd /work/web && npm ci && npm run build
|
WORKDIR /work/web
|
||||||
|
RUN npm ci && npm run build
|
||||||
|
|
||||||
# Stage 3: Build go proxy
|
# Stage 3: Poetry to requirements.txt export
|
||||||
|
FROM docker.io/python:3.10.4-slim-bullseye AS poetry-locker
|
||||||
|
|
||||||
|
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
|
||||||
FROM docker.io/golang:1.18.1-bullseye AS builder
|
FROM docker.io/golang:1.18.1-bullseye AS builder
|
||||||
|
|
||||||
WORKDIR /work
|
WORKDIR /work
|
||||||
|
@ -31,7 +44,7 @@ COPY ./go.sum /work/go.sum
|
||||||
|
|
||||||
RUN go build -o /work/authentik ./cmd/server/main.go
|
RUN go build -o /work/authentik ./cmd/server/main.go
|
||||||
|
|
||||||
# Stage 4: Run
|
# Stage 5: Run
|
||||||
FROM docker.io/python:3.10.4-slim-bullseye
|
FROM docker.io/python:3.10.4-slim-bullseye
|
||||||
|
|
||||||
LABEL org.opencontainers.image.url https://goauthentik.io
|
LABEL org.opencontainers.image.url https://goauthentik.io
|
||||||
|
@ -43,19 +56,18 @@ WORKDIR /
|
||||||
ARG GIT_BUILD_HASH
|
ARG GIT_BUILD_HASH
|
||||||
ENV GIT_BUILD_HASH=$GIT_BUILD_HASH
|
ENV GIT_BUILD_HASH=$GIT_BUILD_HASH
|
||||||
|
|
||||||
COPY ./pyproject.toml /
|
COPY --from=poetry-locker /work/requirements.txt /
|
||||||
COPY ./poetry.lock /
|
COPY --from=poetry-locker /work/requirements-dev.txt /
|
||||||
|
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y --no-install-recommends \
|
# Required for installing pip packages
|
||||||
curl ca-certificates gnupg git runit libpq-dev \
|
apt-get install -y --no-install-recommends build-essential pkg-config libxmlsec1-dev && \
|
||||||
postgresql-client build-essential libxmlsec1-dev \
|
# Required for runtime
|
||||||
pkg-config libmaxminddb0 && \
|
apt-get install -y --no-install-recommends libxmlsec1-openssl libmaxminddb0 && \
|
||||||
pip install poetry && \
|
# Required for other things
|
||||||
poetry config virtualenvs.create false && \
|
apt-get install -y --no-install-recommends runit && \
|
||||||
poetry install --no-dev && \
|
pip install --no-cache-dir -r /requirements.txt && \
|
||||||
rm -rf ~/.cache/pypoetry && \
|
apt-get remove --purge -y build-essential pkg-config libxmlsec1-dev && \
|
||||||
apt-get remove --purge -y build-essential git && \
|
|
||||||
apt-get autoremove --purge -y && \
|
apt-get autoremove --purge -y && \
|
||||||
apt-get clean && \
|
apt-get clean && \
|
||||||
rm -rf /tmp/* /var/lib/apt/lists/* /var/tmp/ && \
|
rm -rf /tmp/* /var/lib/apt/lists/* /var/tmp/ && \
|
||||||
|
|
9
Makefile
9
Makefile
|
@ -18,6 +18,15 @@ test-e2e-rest:
|
||||||
test-go:
|
test-go:
|
||||||
go test -timeout 0 -v -race -cover ./...
|
go test -timeout 0 -v -race -cover ./...
|
||||||
|
|
||||||
|
test-docker:
|
||||||
|
echo "PG_PASS=$(openssl rand -base64 32)" >> .env
|
||||||
|
echo "AUTHENTIK_SECRET_KEY=$(openssl rand -base64 32)" >> .env
|
||||||
|
docker-compose pull -q
|
||||||
|
docker-compose up --no-start
|
||||||
|
docker-compose start postgresql redis
|
||||||
|
docker-compose run -u root server test
|
||||||
|
rm -f .env
|
||||||
|
|
||||||
test:
|
test:
|
||||||
coverage run manage.py test authentik
|
coverage run manage.py test authentik
|
||||||
coverage html
|
coverage html
|
||||||
|
|
|
@ -54,9 +54,7 @@ elif [[ "$1" == "flower" ]]; then
|
||||||
elif [[ "$1" == "bash" ]]; then
|
elif [[ "$1" == "bash" ]]; then
|
||||||
/bin/bash
|
/bin/bash
|
||||||
elif [[ "$1" == "test" ]]; then
|
elif [[ "$1" == "test" ]]; then
|
||||||
# https://github.com/python-poetry/poetry/issues/4493
|
pip install --no-cache-dir -r /requirements-dev.txt
|
||||||
pip install platformdirs
|
|
||||||
poetry install
|
|
||||||
touch /unittest.xml
|
touch /unittest.xml
|
||||||
chown authentik:authentik /unittest.xml
|
chown authentik:authentik /unittest.xml
|
||||||
check_if_root "python -m manage test authentik"
|
check_if_root "python -m manage test authentik"
|
||||||
|
|
|
@ -10,7 +10,7 @@ To create a local development setup for authentik, you need the following:
|
||||||
|
|
||||||
- Python 3.10
|
- Python 3.10
|
||||||
- poetry, which is used to manage dependencies, and can be installed with `pip install poetry`
|
- poetry, which is used to manage dependencies, and can be installed with `pip install poetry`
|
||||||
- Go 1.16
|
- Go 1.18
|
||||||
- PostgreSQL (any recent version will do)
|
- PostgreSQL (any recent version will do)
|
||||||
- Redis (any recent version will do)
|
- Redis (any recent version will do)
|
||||||
|
|
||||||
|
|
Reference in New Issue