diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..88d93b3 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,9 @@ +/node_modules + +/.next/ + +/build + +npm-debug.log +yarn-debug.log* +yarn-error.log* \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..524996f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM node:10 + +WORKDIR /usr/src/app + +COPY package*.json ./ + +RUN npm install + +COPY . . + +RUN npm run build + +CMD ["npm", "start"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..9b17065 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,8 @@ +version: '3' +services: + app: + container_name: apollo-next-graphql + restart: always + build: . + ports: + - '3000:3000' \ No newline at end of file diff --git a/lib/apollo.js b/lib/apollo.js index 36a7660..e72d87b 100644 --- a/lib/apollo.js +++ b/lib/apollo.js @@ -3,7 +3,7 @@ import { HttpLink } from 'apollo-boost' const config = { link: new HttpLink({ - uri: 'http://localhost:3000/api/graphql', + uri: process.env.GRAPHQL_API_URI, opts: { credentials: 'same-origin' } diff --git a/next.config.js b/next.config.js index d6ef8db..5a3fc12 100644 --- a/next.config.js +++ b/next.config.js @@ -9,5 +9,8 @@ module.exports = withSass({ config.optimization.minimizer.push(new OptimizeCSSAssetsPlugin({})) return config + }, + env: { + GRAPHQL_API_URI: 'http://localhost:3000/api/graphql' } })