Skip to content

Commit

Permalink
chore: docker & console remove
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafat97 committed Jun 3, 2022
1 parent d92c14d commit 3b4185a
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Dockerfile
Dockerfile.DEV
Dockerfile.PROD
Dockerfile.prod
.dockerignore
node_modules
yarn.lock
package-lock.json
npm-debug.log
README.md
.next
build
13 changes: 13 additions & 0 deletions Dockerfile.DEV
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM node:lts-alpine

RUN apk add --no-cache libc6-compat

ENV NODE_ENV development

WORKDIR /usr/src/app

COPY ./package.json /usr/src/app/

RUN yarn install --frozen-lockfile

EXPOSE 3000
13 changes: 13 additions & 0 deletions Dockerfile.PROD
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM buildkite/puppeteer as build

WORKDIR /app/code
COPY . /app/code

RUN npm install
RUN npm run build

FROM nginx:stable-alpine
COPY --from=build /app/code/build /usr/share/nginx/html
EXPOSE 80

CMD ["nginx", "-g", "daemon off;"]
22 changes: 22 additions & 0 deletions docker-compose-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: "3.3"

networks:
react-play-network:

services:
### For development
web-dev:
build:
context: .
dockerfile: ./Dockerfile.DEV
command: yarn run start
container_name: react-play-frontend-app-dev
image: react-play-frontend-app-dev:v1
restart: always
volumes:
- ./:/usr/src/app
- /usr/src/app/node_modules
ports:
- "3000:3000"
networks:
- react-play-network
18 changes: 18 additions & 0 deletions docker-compose-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: "3.3"

networks:
react-play-network:

services:
### For production
web-prod:
build:
context: .
dockerfile: ./Dockerfile.PROD
container_name: react-play-frontend-app-prod
image: react-play-frontend-app-prod:v1
restart: always
ports:
- "80:80"
networks:
- react-play-network
8 changes: 8 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ import React, { useState } from "react";
import { createRoot } from 'react-dom/client';
import reportWebVitals from "reportWebVitals";

/** removing console statement in react prod build */
if (process.env.NODE_ENV !== "development") {
console.log = () => {};
console.debug = () => {};
console.info = () => {};
console.disableYellowBox = true;
}

const Index = () => {
const [searchTerm, setSearchTerm] = useState("");
const [filterQuery, setFilterQuery] = useState({
Expand Down

0 comments on commit 3b4185a

Please sign in to comment.