Skip to content

Commit f3b0f41

Browse files
committed
batch.Dockerfile
1 parent 086bb79 commit f3b0f41

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

lambdas/filenameprocessor/batch.Dockerfile

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,37 @@
11
FROM public.ecr.aws/lambda/python:3.11 as base
22

3-
RUN pip install "poetry~=2.1.4"
4-
5-
COPY poetry.lock pyproject.toml README.md ./
3+
# Create a non-root user with a specific UID and GID
4+
RUN mkdir -p /home/appuser && \
5+
echo 'appuser:x:1001:1001::/home/appuser:/sbin/nologin' >> /etc/passwd && \
6+
echo 'appuser:x:1001:' >> /etc/group && \
7+
chown -R 1001:1001 /home/appuser && pip install "poetry~=2.1.4"
8+
9+
# Install Poetry dependencies
10+
# Copy filenameprocessor Poetry files
11+
COPY ./filenameprocessor/poetry.lock ./filenameprocessor/pyproject.toml ./filenameprocessor/README.md ./
12+
13+
# Install filenameprocessor dependencies
14+
WORKDIR /var/task
615
RUN poetry config virtualenvs.create false && poetry install --no-interaction --no-ansi --no-root --only main
716

817
# -----------------------------
918
FROM base as test
1019

20+
# Set working directory back to Lambda task root
21+
WORKDIR /var/task
22+
1123
RUN poetry install --no-interaction --no-ansi --no-root
1224

1325
# Install coverage
1426
RUN pip install coverage
1527

28+
# Copy shared source code
29+
COPY ./shared/src/common ./src/common
30+
31+
# Copy filenameprocessor source & test code
32+
COPY ./filenameprocessor/src ./src
33+
COPY ./filenameprocessor/tests ./tests
34+
1635
COPY src src
1736
COPY tests tests
1837
RUN python -m unittest
@@ -26,6 +45,6 @@ RUN mkdir -p /output/coverage-report && cp -r htmlcov/* /output/coverage-report/
2645
# -----------------------------
2746
FROM base as build
2847

29-
COPY src .
48+
COPY ./filenameprocessor/src .
3049
RUN chmod 644 $(find . -type f)
3150
RUN chmod 755 $(find . -type d)

0 commit comments

Comments
 (0)