-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
I focused on Docker issues and that's the result
- Use package-lock.json through command: npm ci - Fixes regarding Docker Compose setup - Multistage build to get only what is needed for PRD image Useful links - https://git.io/JebrQ - webpack/webpack#520 (comment)
- Loading branch information
1 parent
e77db4f
commit d7959c2
Showing
5 changed files
with
183 additions
and
204 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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Defaults | ||
.git | ||
*Dockerfile* | ||
*docker-compose* | ||
|
||
# Logs | ||
logs | ||
*.log | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by some tools | ||
coverage | ||
|
||
# Dependency directory | ||
node_modules | ||
|
||
# Custom | ||
__tests__ | ||
jest.config.js |
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,9 +1,23 @@ | ||
FROM node:12.14.0-alpine | ||
FROM node:12-alpine as build | ||
|
||
WORKDIR /app | ||
|
||
COPY . /app | ||
|
||
RUN npm run build | ||
# I don't know why but Next.JS require devDependencies to build the project | ||
RUN npm ci --only=production | ||
RUN cp -R node_modules prod_node_modules | ||
RUN npm ci && npm run build | ||
|
||
FROM node:12-alpine | ||
|
||
WORKDIR /app | ||
|
||
# Copy production node_modules | ||
COPY --from=build /app/prod_node_modules ./node_modules | ||
COPY --from=build /app/package.json ./ | ||
# Server-side | ||
COPY --from=build /app/src ./src | ||
# SPA | ||
COPY --from=build /app/dist ./dist | ||
|
||
CMD npm run start |
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
Oops, something went wrong.