-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
35 lines (28 loc) · 977 Bytes
/
Copy pathDockerfile
File metadata and controls
35 lines (28 loc) · 977 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
FROM node:20-alpine AS development
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm ci --legacy-peer-deps
COPY . .
RUN npm run build && \
echo "==== DIST TREE (up to 4 levels) ====" && \
(find dist -maxdepth 4 -type f -print || true) && \
(find dist -maxdepth 4 -type f -name 'main*.js' -print || true)
EXPOSE 3000
ENTRYPOINT [ "sh", "-c", "\
set -e; \
echo 'Starting API…'; \
if [ -f dist/main.js ]; then \
echo '-> Running dist/main.js'; exec node dist/main.js; \
elif [ -f dist/src/main.js ]; then \
echo '-> Running dist/src/main.js'; exec node dist/src/main.js; \
else \
CANDIDATE=$(find dist -maxdepth 4 -type f -name 'main*.js' | head -n1); \
if [ -n \"$CANDIDATE\" ]; then \
echo \"-> Running $CANDIDATE\"; exec node \"$CANDIDATE\"; \
else \
echo 'ERROR: No main*.js found under dist'; \
echo 'Contents of dist:'; find dist -maxdepth 4 -type f -print || true; \
exit 1; \
fi; \
fi \
" ]