Skip to content

Commit

Permalink
Merge pull request #2479 from sveltejs/gcloud-builds
Browse files Browse the repository at this point in the history
site: use gcloud CLI to build Docker image
  • Loading branch information
Rich-Harris authored Apr 22, 2019
2 parents aa0abb1 + 8866e5a commit 8e1fa57
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
9 changes: 9 additions & 0 deletions site/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
!/Dockerfile
!/package.json
!/package-lock.json
!/__sapper__
/__sapper__/*
!/__sapper__/build
!/static
!/content
1 change: 1 addition & 0 deletions site/.gcloudignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#!include:.dockerignore
8 changes: 3 additions & 5 deletions site/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@ FROM mhart/alpine-node:11.14

# 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
COPY package.json package-lock.json ./
RUN npm ci --production

###
# Only copy over the Node pieces we need
Expand All @@ -16,6 +13,7 @@ FROM mhart/alpine-node:base-11.14

WORKDIR /app
COPY --from=0 /app .
COPY . .

EXPOSE 3000
CMD ["node", "__sapper__/build"]
4 changes: 1 addition & 3 deletions site/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ sapper:

docker:
@echo "\n~> building docker image"
@docker build . -t $(IMAGE)
@echo "\n~> pushing docker image"
@docker push $(IMAGE)
@gcloud builds submit -t $(IMAGE)


deploy: sapper docker
Expand Down

0 comments on commit 8e1fa57

Please sign in to comment.