Skip to content

Instantly share code, notes, and snippets.

@dpkirchner
Created August 15, 2019 16:44
Show Gist options
  • Save dpkirchner/a12bdbd1e2b37f350577a27ced7ef527 to your computer and use it in GitHub Desktop.
Save dpkirchner/a12bdbd1e2b37f350577a27ced7ef527 to your computer and use it in GitHub Desktop.
node_modules
build
FROM node:12-alpine
ARG dev
EXPOSE 8080
ENV PORT=8080
ENV DEV="$dev"
WORKDIR /app
# Download the dependencies
COPY package*.json /app/
RUN [[ "$dev" == 1 ]] && npm install || npm install --production
# Install the app files
COPY . .
# Build the app
RUN npm build
# Start the app
CMD ["npm", "start"]
"imageName": "name-of-app",
"imageRegistry": "docker-registry.wint.livelyvideo.tv/",
...
"scripts": {
...
"docker:build:release": "docker build -t ${npm_package_imageRegistry}${npm_package_imageName}:${npm_package_version} .",
"docker:push:release": "docker push ${npm_package_imageRegistry}${npm_package_imageName}:${npm_package_version}",
"docker:build:dev": "docker build -t ${npm_package_imageRegistry}${npm_package_imageName}:${npm_package_version}-dev --build-arg dev=1 ..",
"docker:push:dev": "docker push ${npm_package_imageRegistry}${npm_package_imageName}:${npm_package_version}-dev",
"docker:test:dev": "npm run docker:build:dev && docker run --rm --entrypoint npm ${npm_package_imageRegistry}${npm_package_imageName}:${npm_package_version}-dev run test",
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment