Skip to content

Commit 686672a

Browse files
committed
Make docker multistage for testing.
1 parent 8f2cbf3 commit 686672a

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

Dockerfile

+13-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# limitations under the License.
1818
#
1919

20-
FROM node:20-bookworm-slim
20+
FROM node:20-bookworm-slim AS base
2121

2222
# Image descriptor
2323
LABEL copyright.name="Vicente Eduardo Ferrer Garcia" \
@@ -29,15 +29,24 @@ LABEL copyright.name="Vicente Eduardo Ferrer Garcia" \
2929

3030
WORKDIR /metacall
3131

32-
RUN apt-get update \
33-
&& apt-get install wget ca-certificates -y --no-install-recommends \
34-
&& wget -O - https://raw.githubusercontent.com/metacall/install/master/install.sh | sh
32+
FROM base AS deps
3533

3634
COPY . .
3735

3836
RUN npm install \
3937
&& npm run build
4038

39+
FROM base as faas
40+
41+
RUN apt-get update \
42+
&& apt-get install wget ca-certificates -y --no-install-recommends \
43+
&& wget -O - https://raw.githubusercontent.com/metacall/install/master/install.sh | sh
44+
45+
COPY --from=deps /metacall/node_modules node_modules
46+
COPY --from=deps /metacall/dist dist
47+
4148
EXPOSE 9000
4249

4350
CMD ["node", "dist/index.js"]
51+
52+
# TODO: testing

docker-compose.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,8 @@ services:
2626
build:
2727
context: .
2828
dockerfile: Dockerfile
29+
target: faas
2930
ports:
30-
- "9000:9000"
31+
- "9000:9000"
32+
33+
# TODO: testing

0 commit comments

Comments
 (0)