From 22bbf2665bf69c6e57767b33768ea05195a3c496 Mon Sep 17 00:00:00 2001 From: AP Date: Wed, 1 Apr 2020 21:38:35 +0200 Subject: [PATCH] chore: docker cleanup and changes --- client/.gitignore | 4 ++++ client/Dockerfile | 10 +++------- client/src/App.tsx | 5 +---- docker-compose.yml | 6 +++--- 4 files changed, 11 insertions(+), 14 deletions(-) diff --git a/client/.gitignore b/client/.gitignore index 4d29575d..77315343 100644 --- a/client/.gitignore +++ b/client/.gitignore @@ -11,8 +11,12 @@ # production /build +#webpack +/dist + # misc .DS_Store +.env .env.local .env.development.local .env.test.local diff --git a/client/Dockerfile b/client/Dockerfile index 49eee3a6..0725fd8c 100644 --- a/client/Dockerfile +++ b/client/Dockerfile @@ -1,4 +1,3 @@ -# stage: 1 FROM node:11-alpine as build WORKDIR /usr/src/client @@ -10,9 +9,6 @@ RUN yarn install --production=true COPY . /usr/src/client RUN yarn build -# stage: 2 — the production environment -FROM nginx:alpine -COPY /config/nginx.conf /etc/nginx/conf.d/default.conf -COPY --from=build /usr/src/client/build /usr/share/nginx/html/ -EXPOSE 80 -CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file +RUN yarn global add serve + +CMD ["serve", "-s", "build"] \ No newline at end of file diff --git a/client/src/App.tsx b/client/src/App.tsx index 1b9c1133..02073231 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -24,10 +24,7 @@ const ContentView = React.lazy(() => import('./sections/content/Content')); toast.configure({ draggable: false }); const client = new ApolloClient({ - uri: - process.env.NODE_ENV === 'development' - ? 'http://localhost:3001' - : 'https://api.thunderhub.io/', + uri: process.env.REACT_APP_API_URL ?? 'http://localhost:3001', }); const ContextApp: React.FC = () => { diff --git a/docker-compose.yml b/docker-compose.yml index 0c5f3285..b54d0742 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,6 +4,7 @@ services: ### SETUP SERVER CONTAINER ########################## backend: + image: apotdevin/thunderhub-server build: context: ./server dockerfile: Dockerfile @@ -18,13 +19,12 @@ services: ### SETUP CLIENT CONTAINER ########################## frontend: + image: apotdevin/thunderhub-client build: context: ./client dockerfile: Dockerfile - environment: - - NODE_ENV=production ports: - - "80:80" + - "5000:5000" volumes: - ./client/ depends_on: