1
0
Fork 0
mirror of https://github.com/SunRed/haste-server.git synced 2024-10-31 17:30:20 +01:00
haste-server/Dockerfile
Manuel 3606db4d90
Make Docker image smaller and fix issue with ignore files
* Exclude a bunch of files and directories not needed for Docker image
* Exclude dev dependencies for Docker image build by introducing a production build script
* Using a different alpine base image and multi-stage build reduces the Docker image by roughly 35 MB alone
* Move babel to dev dependencies
* Fix highlight.min.js accidentally being ignored
2021-02-13 10:35:12 +01:00

30 lines
723 B
Docker

FROM mhart/alpine-node:14 AS build
WORKDIR /usr/src/app
COPY . .
# Replace prod with prod-min to exclude the optional dbms dependencies
# and uncomment the needed one below to build a smaller Docker image.
RUN npm run prod
#RUN npm install pg
#RUN npm install aws-sdk
#RUN npm install memcached
#RUN npm install mongodb
#RUN npm install ioredis
#RUN npm install rethinkdbdash
FROM mhart/alpine-node:slim-14
RUN apk add --no-cache curl
WORKDIR /app
COPY --from=build /usr/src/app .
ENV PORT=7777
EXPOSE ${PORT}
STOPSIGNAL SIGINT
ENTRYPOINT [ "node", "server.js" ]
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s \
--retries=1 CMD curl -sS -o /dev/null localhost:${PORT} || exit 1
CMD [ "npm", "start" ]