diff --git a/site/Dockerfile b/site/Dockerfile new file mode 100644 index 0000000000..6674e45336 --- /dev/null +++ b/site/Dockerfile @@ -0,0 +1,21 @@ +FROM mhart/alpine-node:10.15 + +# install dependencies +WORKDIR /app +COPY static /app/static +COPY content /app/content +COPY __sapper__ /app/__sapper__ +COPY package.json package-lock.json /app/ +RUN npm install --production + +### +# Only copy over the Node pieces we need +# ~> Saves 35MB +### +FROM mhart/alpine-node:base-10.15 + +WORKDIR /app +COPY --from=0 /app . + +EXPOSE 3000 +CMD ["node", "__sapper__/build"] diff --git a/site/Makefile b/site/Makefile new file mode 100644 index 0000000000..c41be0fda7 --- /dev/null +++ b/site/Makefile @@ -0,0 +1,24 @@ +HASH := `git rev-parse --short HEAD` + +SERVICE := svelte-website +PROJECT := svelte-dev + +IMAGE := gcr.io/$(PROJECT)/$(SERVICE):$(HASH) + +sapper: + @echo "\n~> updating template & contributors list" + @npm run update + @echo "\n~> building Sapper app" + @npm run sapper + + +docker: + @echo "\n~> building docker image" + @docker build . -t $(IMAGE) + @echo "\n~> pushing docker image" + @docker push $(IMAGE) + + +deploy: sapper docker + @echo "\n~> deploying $(SERVICE) to Cloud Run servers" + @gcloud beta run deploy $(SERVICE) --allow-unauthenticated --region us-central1 --image $(IMAGE) --memory=512Mi diff --git a/site/package.json b/site/package.json index d22683478a..a0fbd9f84a 100644 --- a/site/package.json +++ b/site/package.json @@ -11,10 +11,7 @@ "cy:run": "cypress run", "cy:open": "cypress open", "test": "run-p --race dev cy:run", - "testsrc": "mocha -r esm test/**", - "deploy": "npm run stage && now alias", - "prestage": "npm run update && npm run sapper", - "stage": "now" + "testsrc": "mocha -r esm test/**" }, "dependencies": { "codemirror": "^5.44.0",