generated from ita-social-projects/DevTemplate
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #177 from ita-social-projects/feature/react-docker
Fixed docker file react
- Loading branch information
Showing
7 changed files
with
17,797 additions
and
23 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
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,6 +1,6 @@ | ||
node_modules | ||
npm-debug.log | ||
**/node_modules | ||
**/npm-debug.log | ||
build | ||
.git | ||
*.md | ||
.gitignore | ||
.gitignore |
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,12 +1,21 @@ | ||
FROM node:14 | ||
WORKDIR ./ | ||
COPY ["package*.json","./"] | ||
COPY **/package-lock.json ./ | ||
FROM node:16-alpine as builder | ||
# Set the working directory to /app inside the container | ||
WORKDIR /app | ||
# Copy app files | ||
COPY . . | ||
RUN npm install | ||
RUN npm install validator | ||
RUN npm i react-router-dom@6.4.1 | ||
RUN npm install react-cookie | ||
RUN npm install react-hook-form | ||
EXPOSE 3000 | ||
CMD ["npm", "start"] | ||
# Install dependencies (npm ci makes sure the exact versions in the lockfile gets installed) | ||
RUN npm ci | ||
# Build the app | ||
RUN npm run build | ||
|
||
# Bundle static assets with nginx | ||
FROM nginx:1.21.0-alpine as production | ||
ENV NODE_ENV production | ||
# Copy built assets from `builder` image | ||
COPY --from=builder /app/build /usr/share/nginx/html | ||
# Add your nginx.conf | ||
COPY nginx.conf /etc/nginx/conf.d/default.conf | ||
# Expose port | ||
EXPOSE 80 | ||
# Start nginx | ||
CMD ["nginx", "-g", "daemon off;"] |
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,12 +1,11 @@ | ||
version: node:14 AS development | ||
version: "3.8" | ||
|
||
services: | ||
frontend: | ||
app: | ||
container_name: frontend | ||
build: . | ||
image: frontend | ||
ports: | ||
- 3000:3000 | ||
stdin_open: true | ||
environment: | ||
- CHOKIDAR_USEPOLLING=true | ||
command: npm start | ||
- 80:80 | ||
build: | ||
context: . | ||
target: production |
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; | ||
|
||
location / { | ||
root /usr/share/nginx/html/; | ||
include /etc/nginx/mime.types; | ||
try_files $uri $uri/ /index.html; | ||
} | ||
} |
Oops, something went wrong.