fabric-samples/asset-transfer-basic/rest-api-typescript/Dockerfile
James Taylor 82b1249f4e Improve Docker support
- default command should be start, rather than start:dev in the docker image
- added a multistage build
- fixed node-gyp error
- removed dev dependencies
- added a start:dotenv script to support a .env file in production (may be useful for
k8s later)
- updated Readme and generateEnv script to simplify the setup
- updated external network in docker-compose.yaml to match the test network

Signed-off-by: James Taylor <jamest@uk.ibm.com>
2021-12-14 14:31:21 +00:00

25 lines
435 B
Docker

FROM node:14-alpine3.12 AS build
RUN apk add --no-cache g++ make python3 dumb-init
WORKDIR /app
COPY --chown=node:node . /app
RUN npm ci
RUN npm run build
RUN npm prune --production
FROM node:14-alpine3.12
ENV NODE_ENV production
WORKDIR /app
COPY --from=build /usr/bin/dumb-init /usr/bin/dumb-init
COPY --chown=node:node --from=build /app .
EXPOSE 3000
USER node
ENTRYPOINT [ "dumb-init", "--", "npm", "run"]
CMD ["start"]