-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Limit husky to non-prod & Upgrade/Fix Docker (#1285)
Upgraded the docker-compose to version 3.8. Upgrade the docker Node.js image to 20-slim. Set mongo image to be the latest instead of a preset version that can go out of date often. Added the ability to set the docker environment as development or production. Added a check to the package.json prepare script to only install husky’s execution in non-production environments. This prevents npm install from failing in production environments, where dev dependencies may not be installed. Husky has been a dev dependency. Fixed a bug where docker-compose was overwriting the application/build folder causing removal of css files that were built with sass. Removed the extra end of line spaces in docker-compose.yml.
- Loading branch information
Showing
4 changed files
with
20 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,18 @@ | ||
FROM node:18-slim | ||
FROM node:20-slim | ||
|
||
WORKDIR /starter | ||
ENV NODE_ENV development | ||
|
||
COPY package.json /starter/package.json | ||
|
||
RUN npm install pm2 -g | ||
RUN npm install --production | ||
|
||
COPY .env.example /starter/.env.example | ||
COPY . /starter | ||
|
||
RUN npm install pm2 -g | ||
RUN if [ "$NODE_ENV" = "production" ]; then \ | ||
npm install --omit=dev; \ | ||
else \ | ||
npm install; \ | ||
fi | ||
|
||
CMD ["pm2-runtime","app.js"] | ||
|
||
EXPOSE 8080 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,14 @@ | ||
version: '3' | ||
version: '3.8' | ||
services: | ||
mongo: | ||
image: mongo:3.6 | ||
image: mongo | ||
web: | ||
build: . | ||
ports: | ||
- "8080:8080" | ||
environment: | ||
- MONGODB_URI=mongodb://mongo:27017/test | ||
- MONGODB_URI=mongodb://mongo:27017/test | ||
links: | ||
- mongo | ||
depends_on: | ||
- mongo | ||
volumes: | ||
- .:/starter | ||
- /starter/node_modules | ||
|
||
- mongo | ||
depends_on: | ||
- mongo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters