Skip to content

Commit 7f9f56d

Browse files
committed
feat: modify Docker configs for typescript
1 parent 5fd3ab2 commit 7f9f56d

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

.dockerignore

+1
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ lib/state.json
88
.eslintrc.json
99
test
1010
.eslintignore
11+
dist

Dockerfile

+11-3
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,30 @@ RUN adduser --disabled-password -home /home/cfu -shell /bin/bash cfu
33
WORKDIR /root/cf-runtime
44
COPY package.json yarn.lock ./
55

6-
FROM base AS dependencies
6+
FROM base AS build-dependencies
77
RUN apt-get update \
88
&& apt upgrade -y \
99
&& apt-get install -y \
1010
g++ \
1111
git \
1212
make \
1313
python3
14+
15+
FROM build-dependencies AS build
16+
RUN yarn install --frozen-lockfile
17+
COPY . .
18+
RUN yarn build
19+
20+
FROM build-dependencies AS prod-dependencies
1421
RUN yarn install --frozen-lockfile --production
1522

1623
FROM base AS production
17-
COPY --from=dependencies /root/cf-runtime/node_modules ./node_modules
24+
COPY --from=prod-dependencies /root/cf-runtime/node_modules ./node_modules
25+
COPY --from=build /root/cf-runtime/dist ./dist
1826
COPY . .
1927

2028
#purpose of security
2129
RUN npm -g uninstall npm
2230

2331
USER cfu
24-
CMD ["node", "lib/index.js"]
32+
CMD ["node", "dist/index.js"]

0 commit comments

Comments
 (0)