Skip to content

Commit

Permalink
Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
leonyu committed Sep 22, 2024
1 parent 7cda9ae commit 7957f57
Show file tree
Hide file tree
Showing 3 changed files with 130 additions and 12 deletions.
120 changes: 120 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@

# Created by https://www.gitignore.io/api/linux,node,grunt,vim

### grunt ###
# Grunt usually compiles files inside this directory
dist/

# Grunt usually preprocesses files such as coffeescript, compass... inside the .tmp directory
.tmp/

### Linux ###
*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*

### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless

### Vim ###
# Swap
[._]*.s[a-v][a-z]
[._]*.sw[a-p]
[._]s[a-rt-v][a-z]
[._]ss[a-gi-z]
[._]sw[a-p]

# Session
Session.vim

# Temporary
.netrwhist
# Auto-generated tag files
tags
# Persistent undo
[._]*.un~


# End of https://www.gitignore.io/api/linux,node,grunt,vim
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM docker.io/library/alpine:3.20 AS builder
RUN apk add --no-cache nodejs npm
COPY . /build
WORKDIR /build
RUN npm install && npm run lint && npm run build && npm run test -- --ci --coverage
RUN rm -rf node_modules && npm install --omit=dev
RUN mkdir /stage && cp -r /build/dist /build/node_modules /build/package.json /stage
15 changes: 3 additions & 12 deletions cloudbuild.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
steps:
- name: node:lts-alpine
entrypoint: npm
args: ['install']
- name: node:lts-alpine
entrypoint: npm
args: ['run', 'build', '--if-present']
- name: node:lts-alpine
entrypoint: npm
args: ['run', 'lint', '--if-present']
- name: node:lts-alpine
entrypoint: npm
args: ['run', 'test', '--if-present']
- name: "gcr.io/cloud-builders/docker"
args: ["build", "-t", "gcr.io/$PROJECT_ID/$REPO_NAME", "."]
images: ["gcr.io/$PROJECT_ID/$REPO_NAME"]

0 comments on commit 7957f57

Please sign in to comment.