diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..e6d6e32 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +* +!src +!pages +!yarn.lock +!package.json diff --git a/.gitignore b/.gitignore index 2b9ab1e..5858956 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ *.log node_modules .next +out +package-lock.json diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a3d11d2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM mhart/alpine-node:10 +# We store all our files in /usr/src to perform the build +WORKDIR /usr/src +# We first add only the files required for installing deps +# If package.json or yarn.lock don't change, no need to re-install later +COPY package.json yarn.lock ./ +# We install our deps +RUN yarn +# We copy all source files +COPY . . +# We run the build and expose as /public +RUN yarn build && yarn export -- -o /public diff --git a/license.md b/LICENSE similarity index 100% rename from license.md rename to LICENSE diff --git a/readme.md b/README.md similarity index 100% rename from readme.md rename to README.md diff --git a/now.json b/now.json index 4c34292..778edda 100644 --- a/now.json +++ b/now.json @@ -1,3 +1,36 @@ { - "alias": "title.sh" + "alias": "title.sh", + "type": "static", + "static": { + "directoryListing": false, + "headers": [ + { + "source": "/_next/webpack/chunks/*", + "headers": [ + { + "key": "Cache-Control", + "value": "public, max-age=31536000, immutable" + } + ] + }, + { + "source": "/_next/static/commons/**", + "headers": [ + { + "key": "Cache-Control", + "value": "public, max-age=31536000, immutable" + } + ] + }, + { + "source": "/_next/*/page/**/*.js", + "headers": [ + { + "key": "Cache-Control", + "value": "public, max-age=31536000, immutable" + } + ] + } + ] + } } diff --git a/package.json b/package.json index 1a7e2f1..3704feb 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,8 @@ "scripts": { "dev": "next", "start": "next start", - "build": "next build" + "build": "next build", + "export": "next export" }, "repository": "zeit/title-site", "license": "MIT",