-
-
Notifications
You must be signed in to change notification settings - Fork 217
/
Dockerfile
76 lines (65 loc) · 2.75 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# syntax=docker/dockerfile:1
# This Dockerfile is built as the `dimagi/commcarehq_base` image, which
# is used for running tests.
FROM ghcr.io/astral-sh/uv:0.5.2-python3.9-bookworm-slim
MAINTAINER Dimagi <[email protected]>
ENV PYTHONUNBUFFERED=1 \
PYTHONUSERBASE=/vendor \
PATH=/vendor/bin:$PATH \
NODE_VERSION=20.11.1 \
UV_COMPILE_BYTECODE=1 \
UV_LINK_MODE=copy
# UV_COMPILE_BYTECODE: Compile bytecode during installation to improve module
# load performance. Also suppresses a couchdbkit syntax error that happens
# during bytecode compilation.
# UV_LINK_MODE: Copy from the cache instead of linking since it's a mounted volume
RUN mkdir /vendor
RUN apt-get update \
&& apt-get install -y --no-install-recommends curl gnupg \
&& curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
bzip2 \
default-jre \
gettext \
git \
google-chrome-stable \
libmagic1 \
libpq-dev \
libxml2 \
libxmlsec1 \
libxmlsec1-openssl \
make \
&& rm -rf /var/lib/apt/lists/* /src/*.deb
# build-essential allows uv to build uwsgi; increases image size by 240 MB
# libpq-dev is for make-requirements-test.sh; increases image size by ~20 MB
# libpq-dev can be replaced with libpq5 if pip-tools is replaced with uv in make-requirements-test.sh
RUN curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.gz" \
&& tar -xzf "node-v$NODE_VERSION-linux-x64.tar.gz" -C /usr/local --strip-components=1 \
&& rm "node-v$NODE_VERSION-linux-x64.tar.gz"
COPY requirements/test-requirements.txt package.json /vendor/
RUN --mount=type=cache,target=/root/.cache/uv \
uv venv --allow-existing /vendor \
&& uv pip install --prefix=/vendor -r /vendor/test-requirements.txt
# this keeps the image size down, make sure to set in mocha-headless-chrome options
# executablePath: 'google-chrome-stable'
ENV PUPPETEER_SKIP_DOWNLOAD true
RUN npm -g install \
yarn \
bower \
grunt-cli \
uglify-js \
puppeteer \
mocha-headless-chrome \
sass \
&& cd /vendor \
&& npm shrinkwrap \
&& yarn global add phantomjs-prebuilt
# For backward compatibility with commcarehq_base image containing
# google-chrome-unstable. Can be removed after all test jobs with Gruntfile.js
# referencing google-chrome-unstable have completed (at least a few weeks or
# months after the PR in which this was introduced is merged). Old PRs can be
# updated to use google-chrome-stable by merging master into them.
RUN ln -s /usr/bin/google-chrome-stable /usr/bin/google-chrome-unstable