Merge pull request #2479 from sveltejs/gcloud-builds

site: use gcloud CLI to build Docker image
pull/2481/head
Rich Harris 6 years ago committed by GitHub
commit 8e1fa5755f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,9 @@
/*
!/Dockerfile
!/package.json
!/package-lock.json
!/__sapper__
/__sapper__/*
!/__sapper__/build
!/static
!/content

@ -0,0 +1 @@
#!include:.dockerignore

@ -2,11 +2,8 @@ FROM mhart/alpine-node:11.14
# install dependencies # install dependencies
WORKDIR /app WORKDIR /app
COPY static /app/static COPY package.json package-lock.json ./
COPY content /app/content RUN npm ci --production
COPY __sapper__ /app/__sapper__
COPY package.json package-lock.json /app/
RUN npm install --production
### ###
# Only copy over the Node pieces we need # Only copy over the Node pieces we need
@ -16,6 +13,7 @@ FROM mhart/alpine-node:base-11.14
WORKDIR /app WORKDIR /app
COPY --from=0 /app . COPY --from=0 /app .
COPY . .
EXPOSE 3000 EXPOSE 3000
CMD ["node", "__sapper__/build"] CMD ["node", "__sapper__/build"]

@ -14,9 +14,7 @@ sapper:
docker: docker:
@echo "\n~> building docker image" @echo "\n~> building docker image"
@docker build . -t $(IMAGE) @gcloud builds submit -t $(IMAGE)
@echo "\n~> pushing docker image"
@docker push $(IMAGE)
deploy: sapper docker deploy: sapper docker

Loading…
Cancel
Save