-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathjob-status-change-notification.common.dockerfile
More file actions
44 lines (31 loc) · 1.26 KB
/
job-status-change-notification.common.dockerfile
File metadata and controls
44 lines (31 loc) · 1.26 KB
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
37
38
39
40
41
42
43
44
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# Build stage
FROM node:20 AS builder
RUN npm install -g npm@latest
WORKDIR /usr/src/app
# Copy package files and openpaidbsdk source (needed for file: dependency resolution)
COPY ./src/job-status-change-notification/package.json ./src/job-status-change-notification/yarn.lock* ./src/job-status-change-notification/.yarnrc.yml ./
COPY ./src/job-status-change-notification/openpaidbsdk ./openpaidbsdk
RUN corepack enable && corepack install -g yarn@4.2.2
RUN yarn workspaces focus --production
# Copy application source
COPY ./src/job-status-change-notification .
# Remove openpaidbsdk/node_modules if brought in by source COPY
RUN rm -rf openpaidbsdk/node_modules
# Production stage - use slim image
FROM node:20-slim
WORKDIR /usr/src/app
ENV NODE_ENV=production
# Copy everything from builder (clean, no devDependencies)
COPY --from=builder /usr/src/app .
# Remove npm and corepack to eliminate security warnings
# Clean up apt cache
RUN apt-get update && apt upgrade -y && \
apt purge -y subversion && \
apt-get autoremove -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /usr/local/lib/node_modules
# Use node directly instead of npm
ENTRYPOINT ["node", "index.js"]