Skip to content

Commit d488e77

Browse files
committed
Modify Lambda Adapter configurations
1 parent c48ba64 commit d488e77

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

.github/workflows/backend-prod.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ jobs:
4444
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
4545
ECR_REPOSITORY: ${{ secrets.ECR_REPOSITORY }}
4646
IMAGE_TAG: ${{ github.sha }}
47+
4748
run: |
4849
echo "Building image..."
4950
docker build -f build-context/Dockerfile.prod -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG build-context

apps/backend/Dockerfile.prod

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,14 @@ RUN pip install --no-cache-dir -r requirements.txt
1313
# Copy your application code
1414
COPY src ./src
1515

16-
1716
# -------- Runtime stage: add AWS Lambda Web Adapter + app --------
18-
FROM python:3.11-slim
17+
FROM public.ecr.aws/docker/library/python:3.11-slim-bullseye
18+
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.9.11 \
19+
/lambda-adapter \
20+
/opt/extensions/aws-lambda-adapter
1921

20-
WORKDIR /app
22+
ENV PORT=8080
23+
WORKDIR /var/task
2124

2225
# Copy installed Python packages and app from build stage
2326
COPY --from=build /usr/local /usr/local
@@ -29,9 +32,9 @@ COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.9.1 \
2932
/opt/extensions/aws-lambda-adapter
3033

3134
# Configure the Web Adapter
32-
ENV AWS_LWA_PORT=8000
35+
ENV AWS_LWA_PORT=8080
3336
ENV AWS_LWA_ENABLE_COMPRESSION=true
3437
ENV AWS_LWA_LOG_LEVEL=info
3538

3639
# Start a normal Uvicorn server; Lambda Web Adapter will proxy requests to it
37-
CMD ["uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "8000"]
40+
CMD exec uvicorn --port=$PORT src.main:app

apps/frontend/Dockerfile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@ FROM node:20-alpine
22

33
WORKDIR /app
44

5+
# Install pnpm globally
6+
RUN npm install -g pnpm
7+
58
# Copy dependency files
69
COPY package.json pnpm-lock.yaml ./
710

8-
# Install pnpm and dependencies
9-
RUN npm install -g pnpm && pnpm install
11+
# Install dependencies
12+
RUN pnpm install --frozen-lockfile
1013

1114
# Copy source code
1215
COPY . .
@@ -17,4 +20,5 @@ EXPOSE 5173
1720
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
1821
CMD wget --no-verbose --tries=1 --spider http://localhost:5173 || exit 1
1922

20-
CMD ["pnpm", "dev", "--host", "0.0.0.0"]
23+
# Install dependencies at runtime (in case of volume mounts) and start dev server
24+
CMD ["sh", "-c", "pnpm install && pnpm dev --host 0.0.0.0"]

0 commit comments

Comments
 (0)