-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (28 loc) · 883 Bytes
/
Dockerfile
File metadata and controls
36 lines (28 loc) · 883 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
FROM public.ecr.aws/docker/library/node:22-alpine
# Install system dependencies and AWS CLI in a single layer
RUN apk add --no-cache \
python3 \
py3-pip \
ca-certificates \
groff \
less \
bash \
aws-cli && \
# Clean up pip cache
rm -rf /root/.cache/pip/*
# Set environment variables
ENV NODE_ENV=development \
SERVERLESS_VERSION=4.33.1
# Install Node.js global packages and clean up npm cache in a single layer
RUN npm install -g serverless@${SERVERLESS_VERSION} pnpm && \
npm cache clean --force
# Create a non-root user for better security
RUN addgroup -g 1001 -S serverless && \
adduser -S -D -H -u 1001 -h /app -s /sbin/nologin -G serverless serverless
# Set working directory
WORKDIR /app
# Change ownership of the working directory
RUN chown -R serverless:serverless /app
# Switch to non-root user
USER serverless
ENTRYPOINT ["/bin/bash", "-c"]