Skip to content

Commit a815c5c

Browse files
Merge branch 'nhs-england-tools:main' into main
2 parents eb1ce8d + 3c868fa commit a815c5c

File tree

1 file changed

+25
-6
lines changed

1 file changed

+25
-6
lines changed

buildBase.dockerfile

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,37 @@
1+
# This dockerfile allows for the code from the project to be built into a Docker image,
2+
# for use in a CI/CD-style environment such as GitHub Actions or Jenkins.
3+
# Further reading on this: https://docs.docker.com/get-started/docker-concepts/the-basics/what-is-an-image/
4+
15
FROM python:3.13-slim
26

7+
# Create non-root OS user/group and configure environment
8+
RUN addgroup --system nonroot \
9+
&& adduser --system --home /home/nonroot nonroot --ingroup nonroot
10+
311
WORKDIR /test
412

13+
ENV HOME=/home/nonroot
14+
ENV PATH="$HOME/.local/bin:$PATH"
15+
516
# Install dependencies
617
COPY ./requirements.txt ./requirements.txt
7-
RUN pip install --no-cache-dir -r requirements.txt
8-
RUN playwright install --with-deps
9-
RUN playwright install chrome
18+
RUN pip install --no-cache-dir -r requirements.txt && \
19+
playwright install --with-deps && \
20+
mkdir -p /tests/ && \
21+
mkdir -p /utils/ && \
22+
mkdir -p /pages/
1023

11-
RUN mkdir -p /tests/
24+
# Copy project files
1225
COPY ./tests/ ./tests/
13-
RUN mkdir -p /utils/
1426
COPY ./utils/ ./utils/
27+
COPY ./pages/ ./pages/
28+
COPY ./conftest.py ./conftest.py
1529
COPY ./pytest.ini ./pytest.ini
1630
COPY ./run_tests.sh ./run_tests.sh
31+
COPY ./users.json ./users.json
32+
33+
# Set permissions, make the script executable and switch OS user
34+
RUN chmod +x ./run_tests.sh \
35+
&& chown -R nonroot:nonroot /test
1736

18-
RUN chmod +x ./run_tests.sh
37+
USER nonroot

0 commit comments

Comments
 (0)