Skip to content

Commit 84f475e

Browse files
committed
update poetry commands to not create virtualenv and add additional optimization flags
1 parent 605db19 commit 84f475e

File tree

7 files changed

+796
-40
lines changed

7 files changed

+796
-40
lines changed

.circleci/config.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ commands:
4343
pip3 install flake8 hawkauthlib konfig pyramid pyramid_hawkauth requests simplejson unittest2 WebTest WSGIProxy2 poetry
4444
# NOTE: Python3.12 requires `--break-system-packages`.
4545
# This command is run on the cimg/rust image, which is running python 3.10
46-
poetry install
46+
# pip3 install -r requirements.txt
47+
poetry install --without dev --with tokenserver-unit-tests --no-interaction --no-ansi
4748
rust-check:
4849
steps:
4950
- run:

Dockerfile

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ FROM chef AS cacher
2121
ARG DATABASE_BACKEND
2222
ARG MYSQLCLIENT_PKG
2323

24-
2524
# cmake is required to build grpcio-sys for Spanner builds
2625
RUN \
2726
if [ "$MYSQLCLIENT_PKG" = libmysqlclient-dev ] ; then \
@@ -55,14 +54,11 @@ RUN \
5554
fi && \
5655
apt-get -q update && \
5756
apt-get -q install -y --no-install-recommends $MYSQLCLIENT_PKG cmake golang-go python3-dev python3-pip python3-setuptools python3-wheel pkg-config && \
57+
curl -sSL https://install.python-poetry.org | python3 - && \
58+
ln -s /root/.local/bin/poetry /usr/local/bin/poetry && \
59+
pip3 install -r requirements.txt && \
5860
rm -rf /var/lib/apt/lists/*
5961

60-
RUN curl -sSL https://install.python-poetry.org | python3 -
61-
WORKDIR /app
62-
ADD ./poetry.lock /app
63-
ADD ./pyproject.toml /app
64-
RUN python3 --version
65-
RUN poetry install --without dev
6662

6763

6864
ENV PATH=$PATH:/root/.cargo/bin
@@ -76,6 +72,7 @@ FROM docker.io/library/debian:bullseye-slim
7672
ARG MYSQLCLIENT_PKG
7773

7874
WORKDIR /app
75+
COPY --from=builder /app/requirements.txt /app
7976
COPY --from=builder /app/pyproject.toml /app/poetry.lock /app/
8077

8178
RUN \
@@ -101,8 +98,7 @@ RUN \
10198
apt-get -q remove -y python3-cryptography && \
10299
curl -sSL https://install.python-poetry.org | python3 - && \
103100
ln -s /root/.local/bin/poetry /usr/local/bin/poetry && \
104-
poetry config virtualenvs.create false && \
105-
poetry install --without dev --no-root && \
101+
pip3 install -r /app/requirements.txt && \
106102
rm -rf /var/lib/apt/lists/*
107103

108104
COPY --from=builder /app/bin /app/bin
@@ -115,11 +111,8 @@ COPY --from=builder /app/scripts/start_mock_fxa_server.sh /app/scripts/start_moc
115111
COPY --from=builder /app/syncstorage-spanner/src/schema.ddl /app/schema.ddl
116112

117113
RUN chmod +x /app/scripts/prepare-spanner.sh
118-
WORKDIR /app/tools/integration_tests/
119-
RUN python3 --version
120-
RUN poetry install --without dev --no-root
121-
WORKDIR /app/tools/tokenserver/
122-
RUN poetry install --without dev --no-root
114+
RUN pip3 install -r /app/tools/integration_tests/requirements.txt
115+
RUN pip3 install -r /app/tools/tokenserver/requirements.txt
123116

124117
USER app:app
125118

poetry.lock

Lines changed: 766 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,24 @@ cryptography = "^44.0.2"
1717
pyfxa = "^0.8.1"
1818
tokenlib = "^2.0.0"
1919

20+
[tool.poetry.group.tokenserver-unit-tests.dependencies]
21+
cryptography = "44.0.2"
22+
hawkauthlib = "^2.0.0"
23+
konfig = "^1.1"
24+
mysqlclient = "^2.2.7"
25+
psutil = "^7.0.0"
26+
pyjwt = "^2.10.1"
27+
pyramid = "^2.0.2"
28+
pyramid-hawkauth = "^2.0.0"
29+
pyfxa = "0.8.1"
30+
pytest = "^8.4.0"
31+
requests = "^2.32.4"
32+
simplejson = "^3.20.1"
33+
sqlalchemy = "1.4.46"
34+
tokenlib = "^2.0.0"
35+
webtest = "^3.0.6"
36+
wsgiproxy2 = "^0.5.1"
37+
2038
[tool.poetry.group.dev.dependencies]
2139
mypy = "^1.16.0"
2240
pydocstyle = "^6.3.0"

scripts/start_mock_fxa_server.sh

100644100755
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
#!/bin/sh
22

3-
python3 /app/tools/integration_tests/tokenserver/mock_fxa_server.py
4-
3+
python3 /app/tools/integration_tests/tokenserver/mock_fxa_server.py

tools/integration_tests/tokenserver/mock_fxa_server.py

100644100755
File mode changed.

tools/spanner/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ WORKDIR /app/
1818
COPY purge_ttl.py count_expired_rows.py count_users.py poetry.lock pyproject.toml /app/
1919
RUN python3 --version
2020

21-
RUN poetry install --without dev --no-interaction --no-ansi
21+
RUN poetry config virtualenvs.create false && \
22+
poetry install --without dev --no-interaction --no-ansi
2223

2324
USER nobody
2425

0 commit comments

Comments
 (0)