mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-31 07:40:33 +00:00
examples: add docker example (#5430)
This commit is contained in:
parent
abf7db1fd3
commit
3eec1152f4
84
examples/docker-build/.dockerignore
Normal file
84
examples/docker-build/.dockerignore
Normal 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.*
|
5
examples/docker-build/.yarnclean
Normal file
5
examples/docker-build/.yarnclean
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
*.yaml
|
||||||
|
*.md
|
||||||
|
*.lock
|
||||||
|
LICENSE
|
||||||
|
CHANGELOG
|
12
examples/docker-build/README.md
Normal file
12
examples/docker-build/README.md
Normal 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
|
||||||
|
|
||||||
|
```
|
1
examples/docker-build/assets/README.md
Normal file
1
examples/docker-build/assets/README.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
# ASSETS
|
1
examples/docker-build/components/README.md
Normal file
1
examples/docker-build/components/README.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
# COMPONENTS
|
31
examples/docker-build/dockerfile
Normal file
31
examples/docker-build/dockerfile
Normal 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" ]
|
1
examples/docker-build/layouts/README.md
Normal file
1
examples/docker-build/layouts/README.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
# LAYOUTS
|
8
examples/docker-build/layouts/default.vue
Normal file
8
examples/docker-build/layouts/default.vue
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<nuxt />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
</style>
|
1
examples/docker-build/middleware/README.md
Normal file
1
examples/docker-build/middleware/README.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
# MIDDLEWARE
|
54
examples/docker-build/nuxt.config.js
Normal file
54
examples/docker-build/nuxt.config.js
Normal 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) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
16
examples/docker-build/package.json
Normal file
16
examples/docker-build/package.json
Normal 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"
|
||||||
|
}
|
||||||
|
}
|
1
examples/docker-build/pages/README.md
Normal file
1
examples/docker-build/pages/README.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
# PAGES
|
12
examples/docker-build/pages/index.vue
Normal file
12
examples/docker-build/pages/index.vue
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<h1>It works!</h1>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
</style>
|
1
examples/docker-build/plugins/README.md
Normal file
1
examples/docker-build/plugins/README.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
# PLUGINS
|
1
examples/docker-build/static/README.md
Normal file
1
examples/docker-build/static/README.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
# STATIC
|
BIN
examples/docker-build/static/favicon.ico
Normal file
BIN
examples/docker-build/static/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
1
examples/docker-build/store/README.md
Normal file
1
examples/docker-build/store/README.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
# STORE
|
Loading…
Reference in New Issue
Block a user