Skip to content

Commit 3d2919f

Browse files
committed
init: redis_sync makefiles
1 parent 7c7b8a3 commit 3d2919f

36 files changed

+68
-24
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"python.analysis.extraPaths": [
3+
"./src"
4+
],
5+
"python.testing.unittestArgs": [
6+
"-v",
7+
"-s",
8+
"./",
9+
"-p",
10+
"test_*.py"
11+
],
12+
"python.testing.pytestEnabled": false,
13+
"python.testing.unittestEnabled": true,
14+
"pylint.args": [
15+
"--init-hook",
16+
"import sys; sys.path.append('./src')"
17+
],
18+
"[makefile]": {
19+
"editor.insertSpaces": false,
20+
"editor.detectIndentation": false
21+
},
22+
"files.trimTrailingWhitespace": true,
23+
"[python]": {
24+
"files.trimTrailingWhitespace": true
25+
},
26+
"files.insertFinalNewline": true
27+
}
Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,34 @@ RUN mkdir -p /home/appuser && \
66
echo 'appuser:x:1001:' >> /etc/group && \
77
chown -R 1001:1001 /home/appuser && pip install "poetry~=2.1.4"
88

9-
# Install Poetry as root
10-
COPY poetry.lock pyproject.toml README.md ./
9+
# Install Poetry dependencies
10+
# Copy redis_sync Poetry files
11+
COPY ./redis_sync/poetry.lock ./redis_sync/pyproject.toml ./
12+
COPY ./shared/src/common ./src/common
13+
14+
RUN echo "Listing /var/task after source code copy:" && ls -R /var/task
15+
16+
# Install redis_sync dependencies
17+
WORKDIR /var/task
1118
RUN poetry config virtualenvs.create false && poetry install --no-interaction --no-ansi --no-root --only main
12-
# -----------------------------
13-
FROM base AS test
14-
COPY src src
15-
COPY tests tests
16-
RUN poetry install --no-interaction --no-ansi --no-root && \
17-
pytest --disable-warnings tests
1819

1920
# -----------------------------
2021
FROM base AS build
21-
COPY src .
22+
23+
# Set working directory back to Lambda task root
24+
WORKDIR /var/task
25+
26+
# Copy shared source code
27+
COPY ./shared/src/common ./common
28+
29+
# Copy redis_sync source code
30+
COPY ./redis_sync/src .
31+
32+
# Set correct permissions
2233
RUN chmod 644 $(find . -type f) && chmod 755 $(find . -type d)
34+
2335
# Build as non-root user
2436
USER 1001:1001
37+
38+
# Set the Lambda handler
2539
CMD ["redis_sync.handler"]

lambdas/redis_sync/Makefile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
TEST_ENV := @PYTHONPATH=src:tests:../shared/src
2+
3+
test:
4+
$(TEST_ENV) python -m unittest
5+
6+
coverage-run:
7+
$(TEST_ENV) coverage run -m unittest discover -v
8+
9+
coverage-report:
10+
$(TEST_ENV) coverage report -m
11+
12+
coverage-html:
13+
$(TEST_ENV) coverage html
14+
15+
16+
.PHONY: build package
File renamed without changes.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ description = ""
1313
authors = ["s.wates <[email protected]>"]
1414
readme = "README.md"
1515
packages = [
16-
{include = "src"}
16+
{include = "src"},
17+
{include = "common", from = "../shared/src"}
1718
]
1819

1920
[tool.poetry.dependencies]

0 commit comments

Comments
 (0)