We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 28945a6 commit 94a946cCopy full SHA for 94a946c
1 file changed
01-contenedores/contenedores-iii/doom-web/Dockerfile.multistages
@@ -16,16 +16,22 @@ FROM dependencies AS test
16
# Copy all files for testing
17
COPY . .
18
# Run tests
19
-RUN npm run test
+RUN npm run test && echo "tests passed" > /tmp/tests-passed
20
21
# ---- Release ----
22
FROM base AS release
23
-# Add environment variables
24
-# ENV NODE_ENV production
25
-# Copy only necessary files
+
+ENV NODE_ENV=production
26
+# Copy tests validation file (forces test execution)
27
+COPY --from=test /tmp/tests-passed /tmp/
28
29
+# Install only production dependencies
30
RUN npm install --omit=dev
31
32
+# Copy all files
33
34
35
# Expose port and define CMD
36
EXPOSE 3000
-# Specify what command it'll execute when you create a container
37
CMD ["npm", "start"]
0 commit comments