-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf(docker): build app for production and dockerize
Change Dockerfile to build app for production and server with nginx, rather than running the dev server. Create an nginx config to serve the app. Use .dockerignore to ensure nothing sensitive or wasteful is built into the image. Update .gitignore to prevent commit of build files. Update readme with appropriate nginx port. closes #29
- Loading branch information
1 parent
597acce
commit 6f76ca9
Showing
5 changed files
with
22 additions
and
9 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,4 @@ | ||
.git | ||
.DS_Store | ||
.env | ||
node_modules |
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 |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
|
||
# production | ||
/build | ||
/dist | ||
|
||
# misc | ||
.DS_Store | ||
|
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,13 +1,12 @@ | ||
FROM node:lts-alpine3.17 | ||
FROM node:current-alpine as build | ||
|
||
WORKDIR /usr/src/app | ||
|
||
COPY package*.json ./ | ||
|
||
RUN npm install | ||
|
||
RUN npm clean-install | ||
COPY . . | ||
RUN npm run build | ||
|
||
EXPOSE 3000 | ||
|
||
CMD [ "npm", "run", "dev" ] | ||
FROM nginx:mainline-alpine | ||
EXPOSE 80 | ||
COPY ./docker/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf | ||
COPY --from=build /usr/src/app/dist /usr/share/nginx/html |
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 |
---|---|---|
|
@@ -76,6 +76,6 @@ services: | |
image: jacobtheeldest/minesweeper:latest | ||
restart: unless-stopped | ||
ports: | ||
- "3000:3000" | ||
- "80:80" | ||
``` |
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,9 @@ | ||
server { | ||
listen 80; | ||
root /usr/share/nginx/html; | ||
index index.html; | ||
|
||
location / { | ||
try_files $uri $uri/ /index.html; | ||
} | ||
} |