examples: add docker example (#5430)

This commit is contained in:
Utkarsh Gupta 2019-04-01 03:36:28 +05:30 committed by Pooya Parsa
parent abf7db1fd3
commit 3eec1152f4
17 changed files with 230 additions and 0 deletions

View File

@ -0,0 +1,84 @@
# Created by .ignore support plugin (hsz.mobi)
### Node template
# 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
# Nuxt generate
dist
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless
# IDE
.idea
# Service worker
sw.*

View File

@ -0,0 +1,5 @@
*.yaml
*.md
*.lock
LICENSE
CHANGELOG

View File

@ -0,0 +1,12 @@
# docker-build
## Build Setup
```bash
# Build a nuxt-docker image
$ docker build -t nuxt-docker .
# Run the container for the nuxt-docker image with a exposed port 3000
$ docker run --rm -it -p 3000:3000 nuxt-docker
```

View File

@ -0,0 +1 @@
# ASSETS

View File

@ -0,0 +1 @@
# COMPONENTS

View File

@ -0,0 +1,31 @@
FROM node:latest as builder
WORKDIR /src
COPY . .
RUN yarn install \
--prefer-offline \
--frozen-lockfile \
--non-interactive \
--production=false
RUN yarn build
RUN rm -rf node_modules && \
NODE_ENV=production yarn install \
--prefer-offline \
--pure-lockfile \
--non-interactive \
--production=true
FROM node:alpine
WORKDIR /src
COPY --from=builder /src .
ENV HOST 0.0.0.0
EXPOSE 3000
CMD [ "yarn", "start" ]

View File

@ -0,0 +1 @@
# LAYOUTS

View File

@ -0,0 +1,8 @@
<template>
<div>
<nuxt />
</div>
</template>
<style>
</style>

View File

@ -0,0 +1 @@
# MIDDLEWARE

View File

@ -0,0 +1,54 @@
import pkg from './package'
export default {
mode: 'universal',
/*
** Headers of the page
*/
head: {
title: pkg.name,
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: pkg.description }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
]
},
/*
** Customize the progress-bar color
*/
loading: { color: '#fff' },
/*
** Global CSS
*/
css: [
],
/*
** Plugins to load before mounting the App
*/
plugins: [
],
/*
** Nuxt.js modules
*/
modules: [
],
/*
** Build configuration
*/
build: {
/*
** You can extend webpack config here
*/
extend(config, ctx) {
}
}
}

View File

@ -0,0 +1,16 @@
{
"name": "docker-build",
"scripts": {
"dev": "nuxt",
"build": "nuxt build",
"start": "nuxt-start",
"generate": "nuxt generate"
},
"dependencies": {
"cross-env": "latest",
"nuxt-start": "latest"
},
"devDependencies": {
"nuxt": "latest"
}
}

View File

@ -0,0 +1 @@
# PAGES

View File

@ -0,0 +1,12 @@
<template>
<div>
<h1>It works!</h1>
</div>
</template>
<script>
export default {}
</script>
<style>
</style>

View File

@ -0,0 +1 @@
# PLUGINS

View File

@ -0,0 +1 @@
# STATIC

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1 @@
# STORE