-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbatch.Dockerfile
More file actions
23 lines (22 loc) · 944 Bytes
/
batch.Dockerfile
File metadata and controls
23 lines (22 loc) · 944 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
FROM public.ecr.aws/lambda/python:3.11 AS base
# Create a non-root user with a specific UID and GID
RUN mkdir -p /home/appuser && \
echo 'appuser:x:1001:1001::/home/appuser:/sbin/nologin' >> /etc/passwd && \
echo 'appuser:x:1001:' >> /etc/group && \
chown -R 1001:1001 /home/appuser && pip install "poetry~=1.5.0"
# -----------------------------
COPY poetry.lock pyproject.toml README.md ./
RUN poetry config virtualenvs.create false && poetry install --no-interaction --no-ansi --no-root --only main
# -----------------------------
FROM base AS test
COPY src src
COPY tests tests
RUN poetry install --no-interaction --no-ansi --no-root && \
pytest --disable-warnings tests
# -----------------------------
FROM base AS build
COPY src .
RUN chmod 644 $(find . -type f) && chmod 755 $(find . -type d)
# Switch to the non-root user for running the container
USER 1001:1001
CMD ["forwarding_batch_lambda.forward_lambda_handler"]