| 
									
										
										
										
											2023-02-12 12:53:42 +00:00
										 |  |  | FROM alpine:3.17 as requirements
 | 
					
						
							| 
									
										
										
										
											2022-03-01 18:59:17 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | # We need this additional step to avoid having poetrys deps interacting with our
 | 
					
						
							|  |  |  | # dependencies. This is only required until alpine 3.16 is released, since this
 | 
					
						
							|  |  |  | # allows us to install poetry as package.
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-19 20:49:13 +00:00
										 |  |  | RUN set -eux; \
 | 
					
						
							|  |  |  |   apk add --no-cache \
 | 
					
						
							|  |  |  |   poetry \
 | 
					
						
							|  |  |  |   py3-cryptography \
 | 
					
						
							|  |  |  |   py3-pip \
 | 
					
						
							|  |  |  |   python3
 | 
					
						
							| 
									
										
										
										
											2022-03-01 18:59:17 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-19 20:49:13 +00:00
										 |  |  | COPY pyproject.toml poetry.lock /
 | 
					
						
							|  |  |  | RUN set -eux; \
 | 
					
						
							| 
									
										
										
										
											2023-05-17 15:48:02 +00:00
										 |  |  |   poetry export --without-hashes --extras typesense > requirements.txt; \
 | 
					
						
							| 
									
										
										
										
											2022-12-19 20:49:13 +00:00
										 |  |  |   poetry export --without-hashes --with dev > dev-requirements.txt;
 | 
					
						
							| 
									
										
										
										
											2022-11-09 18:58:58 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-17 15:30:41 +00:00
										 |  |  | FROM alpine:3.17 as builder
 | 
					
						
							| 
									
										
										
										
											2017-06-23 21:00:42 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-11 15:21:16 +00:00
										 |  |  | ENV PYTHONDONTWRITEBYTECODE=1 | 
					
						
							| 
									
										
										
										
											2023-01-11 15:24:51 +00:00
										 |  |  | ENV PYTHONUNBUFFERED=1 | 
					
						
							| 
									
										
										
										
											2023-01-11 15:43:32 +00:00
										 |  |  | ARG PIP_NO_CACHE_DIR=1 | 
					
						
							| 
									
										
										
										
											2023-08-28 13:13:09 +00:00
										 |  |  | ENV CARGO_NET_GIT_FETCH_WITH_CLI=true | 
					
						
							| 
									
										
										
										
											2023-01-11 15:21:16 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-11 16:10:30 +00:00
										 |  |  | RUN set -eux; \
 | 
					
						
							|  |  |  |   apk add --no-cache \
 | 
					
						
							|  |  |  |   cargo \
 | 
					
						
							|  |  |  |   curl \
 | 
					
						
							|  |  |  |   gcc \
 | 
					
						
							| 
									
										
										
										
											2023-09-28 07:43:14 +00:00
										 |  |  |   g++ \
 | 
					
						
							| 
									
										
										
										
											2023-01-11 16:10:30 +00:00
										 |  |  |   git \
 | 
					
						
							|  |  |  |   jpeg-dev \
 | 
					
						
							|  |  |  |   libffi-dev \
 | 
					
						
							|  |  |  |   libldap \
 | 
					
						
							|  |  |  |   libxml2-dev \
 | 
					
						
							|  |  |  |   libxslt-dev \
 | 
					
						
							|  |  |  |   make \
 | 
					
						
							|  |  |  |   musl-dev \
 | 
					
						
							|  |  |  |   openldap-dev \
 | 
					
						
							|  |  |  |   openssl-dev \
 | 
					
						
							|  |  |  |   postgresql-dev \
 | 
					
						
							|  |  |  |   zlib-dev \
 | 
					
						
							| 
									
										
										
										
											2023-03-17 18:50:10 +00:00
										 |  |  |   py3-cryptography=38.0.3-r1 \
 | 
					
						
							| 
									
										
										
										
											2023-07-20 11:00:40 +00:00
										 |  |  |   py3-lxml=4.9.3-r1 \
 | 
					
						
							| 
									
										
										
										
											2023-01-11 16:10:30 +00:00
										 |  |  |   py3-pillow=9.3.0-r0 \
 | 
					
						
							|  |  |  |   py3-psycopg2=2.9.5-r0 \
 | 
					
						
							|  |  |  |   py3-watchfiles=0.18.1-r0 \
 | 
					
						
							|  |  |  |   python3-dev
 | 
					
						
							| 
									
										
										
										
											2019-01-11 12:50:42 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-19 20:49:13 +00:00
										 |  |  | # Create virtual env
 | 
					
						
							| 
									
										
										
										
											2023-01-13 14:22:05 +00:00
										 |  |  | RUN python3 -m venv --system-site-packages /venv
 | 
					
						
							| 
									
										
										
										
											2023-01-20 16:18:40 +00:00
										 |  |  | ENV PATH="/venv/bin:$PATH"
 | 
					
						
							| 
									
										
										
										
											2020-03-09 16:04:06 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-12 12:53:42 +00:00
										 |  |  | COPY --from=requirements /requirements.txt /requirements.txt
 | 
					
						
							|  |  |  | COPY --from=requirements /dev-requirements.txt /dev-requirements.txt
 | 
					
						
							| 
									
										
										
										
											2017-06-23 21:00:42 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-20 12:09:17 +00:00
										 |  |  | RUN --mount=type=cache,target=~/.cache/pip; \
 | 
					
						
							|  |  |  |   set -eux; \
 | 
					
						
							| 
									
										
										
										
											2023-01-11 15:55:30 +00:00
										 |  |  |   pip3 install --upgrade pip; \
 | 
					
						
							|  |  |  |   pip3 install setuptools wheel; \
 | 
					
						
							|  |  |  |   # Currently we are unable to relieably build rust-based packages on armv7. This
 | 
					
						
							|  |  |  |   # is why we need to use the packages shipped by Alpine Linux.
 | 
					
						
							|  |  |  |   # Since poetry does not allow in-place dependency pinning, we need
 | 
					
						
							|  |  |  |   # to install the deps using pip.
 | 
					
						
							|  |  |  |   grep -Ev 'cryptography|lxml|pillow|psycopg2|watchfiles' /requirements.txt \
 | 
					
						
							|  |  |  |   | pip3 install -r /dev/stdin \
 | 
					
						
							|  |  |  |   cryptography==38.0.3 \
 | 
					
						
							| 
									
										
										
										
											2023-07-20 11:00:40 +00:00
										 |  |  |   lxml==4.9.3 \
 | 
					
						
							| 
									
										
										
										
											2023-01-11 15:55:30 +00:00
										 |  |  |   pillow==9.3.0 \
 | 
					
						
							|  |  |  |   psycopg2==2.9.5 \
 | 
					
						
							|  |  |  |   watchfiles==0.18.1
 | 
					
						
							| 
									
										
										
										
											2017-06-23 21:00:42 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-11 15:55:30 +00:00
										 |  |  | ARG install_dev_deps=0 | 
					
						
							| 
									
										
										
										
											2023-07-20 12:09:17 +00:00
										 |  |  | RUN --mount=type=cache,target=~/.cache/pip; \
 | 
					
						
							| 
									
										
										
										
											2023-07-20 13:06:52 +00:00
										 |  |  |   set -eux; \
 | 
					
						
							| 
									
										
										
										
											2023-01-11 15:55:30 +00:00
										 |  |  |   if [ "$install_dev_deps" = "1" ] ; then \
 | 
					
						
							| 
									
										
										
										
											2023-07-20 11:00:40 +00:00
										 |  |  |     grep -Ev 'cryptography|lxml|pillow|psycopg2|watchfiles' /dev-requirements.txt \
 | 
					
						
							|  |  |  |     | pip3 install -r /dev/stdin \
 | 
					
						
							|  |  |  |     cryptography==38.0.3 \
 | 
					
						
							|  |  |  |     lxml==4.9.3 \
 | 
					
						
							|  |  |  |     pillow==9.3.0 \
 | 
					
						
							|  |  |  |     psycopg2==2.9.5 \
 | 
					
						
							|  |  |  |     watchfiles==0.18.1; \
 | 
					
						
							| 
									
										
										
										
											2023-01-11 15:55:30 +00:00
										 |  |  |   fi
 | 
					
						
							| 
									
										
										
										
											2020-03-09 16:04:06 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-12 12:53:42 +00:00
										 |  |  | FROM alpine:3.17 as production
 | 
					
						
							| 
									
										
										
										
											2020-03-09 16:04:06 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-11 15:21:16 +00:00
										 |  |  | ENV PYTHONDONTWRITEBYTECODE=1 | 
					
						
							| 
									
										
										
										
											2023-01-11 15:24:51 +00:00
										 |  |  | ENV PYTHONUNBUFFERED=1 | 
					
						
							| 
									
										
										
										
											2023-01-11 15:43:32 +00:00
										 |  |  | ARG PIP_NO_CACHE_DIR=1 | 
					
						
							| 
									
										
										
										
											2023-01-11 15:21:16 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-11 16:10:30 +00:00
										 |  |  | RUN set -eux; \
 | 
					
						
							|  |  |  |   apk add --no-cache \
 | 
					
						
							|  |  |  |   bash \
 | 
					
						
							|  |  |  |   ffmpeg \
 | 
					
						
							|  |  |  |   gettext \
 | 
					
						
							|  |  |  |   jpeg-dev \
 | 
					
						
							|  |  |  |   libldap \
 | 
					
						
							|  |  |  |   libmagic \
 | 
					
						
							|  |  |  |   libpq \
 | 
					
						
							|  |  |  |   libxml2 \
 | 
					
						
							|  |  |  |   libxslt \
 | 
					
						
							| 
									
										
										
										
											2023-03-17 18:50:10 +00:00
										 |  |  |   py3-cryptography=38.0.3-r1 \
 | 
					
						
							| 
									
										
										
										
											2023-07-20 11:00:40 +00:00
										 |  |  |   py3-lxml=4.9.3-r1 \
 | 
					
						
							| 
									
										
										
										
											2023-01-11 16:10:30 +00:00
										 |  |  |   py3-pillow=9.3.0-r0 \
 | 
					
						
							|  |  |  |   py3-psycopg2=2.9.5-r0 \
 | 
					
						
							|  |  |  |   py3-watchfiles=0.18.1-r0 \
 | 
					
						
							| 
									
										
										
										
											2023-04-26 17:49:42 +00:00
										 |  |  |   python3 \
 | 
					
						
							|  |  |  |   tzdata
 | 
					
						
							| 
									
										
										
										
											2020-03-09 16:04:06 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-11 16:13:03 +00:00
										 |  |  | COPY --from=builder /venv /venv
 | 
					
						
							|  |  |  | ENV PATH="/venv/bin:$PATH"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-12 11:33:52 +00:00
										 |  |  | COPY . /app
 | 
					
						
							|  |  |  | WORKDIR /app
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-20 12:09:17 +00:00
										 |  |  | RUN --mount=type=cache,target=~/.cache/pip; \
 | 
					
						
							| 
									
										
										
										
											2023-07-20 13:06:52 +00:00
										 |  |  |   set -eux; \
 | 
					
						
							| 
									
										
										
										
											2023-01-11 15:45:20 +00:00
										 |  |  |   pip3 install --no-deps --editable .
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-20 17:03:46 +00:00
										 |  |  | ENV IS_DOCKER_SETUP=true | 
					
						
							| 
									
										
										
										
											2022-07-16 18:16:13 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-23 14:44:45 +00:00
										 |  |  | CMD ["./docker/server.sh"]
 |