- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想在 docker 下安装我的 @vue/cli 4.0.5 应用程序,我找到了这个包
https://hub.docker.com/r/ebiven/vue-cli
假设这是我需要的(?)我修改了 _Docker/docker-compose.yml
web:
container_name: vtasks_web
build:
context: ./web
dockerfile: Dockerfile.yml
environment:
- APACHE_RUN_USER=www-data
volumes:
- ${APP_PATH_HOST}:${APP_PTH_CONTAINER}
ports:
- 8088:80
working_dir: ${APP_PTH_CONTAINER}
...
vue_cli:
container_name: vtasks_vue_cli
image: ebiven/vue-cli:latest
volumes:
- ${APP_PATH_HOST}:${APP_PTH_CONTAINER}
working_dir: ${APP_PTH_CONTAINER}
command: npm install
npm run serve
ONE Compiled successfully in 10065ms 4:21:52 PM
App running at:
- Local: http://localhost:8080/
It seems you are running Vue CLI inside a container.
Access the dev server via http://localhost:<your container's external mapped port>/
Note that the development build is not optimized.
To create a production build, run npm run build.
http://localhost:8088/
version: '3.5'
services:
web:
container_name: vtasks_web
image: ebiven/vue-cli
command: npm install
# command: npm install ; npm run serve // I GOT ERROR HERE
# command: npm run serve
build:
context: ./web
dockerfile: Dockerfile.yml
environment:
- APACHE_RUN_USER=www-data
volumes:
- ${APP_PATH_HOST}:${APP_PTH_CONTAINER}
ports:
- "8088:80"
working_dir: ${APP_PTH_CONTAINER}
db:
container_name: vtasks_db
image: mysql:5.7.28
restart: always
environment:
- MYSQL_DATABASE=DockerVTasks
- MYSQL_USER=docker_user
- MYSQL_PASSWORD=4321
- MYSQL_ALLOW_EMPTY_PASSWORD=false
- MYSQL_ROOT_PASSWORD=321
- TZ=Europe/Kiev
volumes:
- ${DB_PATH_HOST}:/var/lib/mysql
adminer:
container_name: vtasks_adminer
image: adminer
restart: always
ports:
- 8089:8080
links:
- db
$ docker-compose up -d --build
Building web
Step 1/6 : FROM php:7.3-apache
---> 5af347316d4b
Step 2/6 : RUN apt-get update && apt-get install -y python libfreetype6-dev libwebp-dev libjpeg62-turbo-dev libpng-dev libzip-dev nano mc git-core curl build-essential openssl libssl-dev libgmp-dev libldap2-dev netcat locate && git clone https://github.com/nodejs/node.git && cd node && git checkout v12.0.0 && ./configure && make && make install
---> Using cache
---> b56b2543f6bd
Step 3/6 : RUN npm install cross-env
---> Using cache
---> f8abda742c47
Step 4/6 : RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-webp-dir=/usr/include/ --with-jpeg-dir=/usr/include/
---> Using cache
---> df0636ba5b86
Step 5/6 : RUN docker-php-ext-install gd pdo pdo_mysql zip gmp bcmath pcntl ldap sysvmsg exif && a2enmod rewrite
---> Using cache
---> 307c9f243f02
Step 6/6 : COPY virtualhost.conf /etc/apache2/sites-enabled/000-default.conf
---> Using cache
---> 3c733883faaa
Successfully built 3c733883faaa
Successfully tagged ebiven/vue-cli:latest
Recreating vtasks_web ...
vtasks_db is up-to-date
Recreating vtasks_web
Recreating vtasks_web ... done
serge@athoe:/mnt/_work_sdb8/wwwroot/lar/VApps/vtasks/_Docker$ docker logs --tail=40 vtasks_web
> node-sass@4.13.0 install /var/www/vtasks_docker_root/node_modules/node-sass
> node scripts/install.js
Downloading binary from https://github.com/sass/node-sass/releases/download/v4.13.0/linux-x64-72_binding.node
Download complete
Binary saved to /var/www/vtasks_docker_root/node_modules/node-sass/vendor/linux-x64-72/binding.node
Caching binary to /root/.npm/node-sass/4.13.0/linux-x64-72_binding.node
> core-js@3.6.1 postinstall /var/www/vtasks_docker_root/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
> https://opencollective.com/core-js
> https://www.patreon.com/zloirock
Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
> ejs@2.7.4 postinstall /var/www/vtasks_docker_root/node_modules/ejs
> node ./postinstall.js
Thank you for installing EJS: built with the Jake JavaScript build tool (https://jakejs.com/)
> node-sass@4.13.0 postinstall /var/www/vtasks_docker_root/node_modules/node-sass
> node scripts/build.js
Binary found at /var/www/vtasks_docker_root/node_modules/node-sass/vendor/linux-x64-72/binding.node
Testing binary
Binary is fine
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
added 1239 packages from 876 contributors and audited 19413 packages in 26.747s
found 0 vulnerabilities
npm run serve
npm install
command: bash -c "npm install && npm run serve"
$ docker logs --tail=20 vtasks_web
<s> [webpack.Progress] 93% after chunk asset optimization
<s> [webpack.Progress] 93% asset optimization
<s> [webpack.Progress] 94% after asset optimization
<s> [webpack.Progress] 94% after seal
<s> [webpack.Progress] 95% emitting
<s> [webpack.Progress] 95% emitting HtmlWebpackPlugin
<s> [webpack.Progress] 95% emitting CopyPlugin
<s> [webpack.Progress] 98% after emitting
<s> [webpack.Progress] 98% after emitting CopyPlugin
DONE Compiled successfully in 10316ms4:36:18 AM
<s> [webpack.Progress] 100%
App running at:
- Local: http://localhost:8080/
It seems you are running Vue CLI inside a container.
Access the dev server via http://localhost:<your container's external mapped port>/
http://localhost:8080/
This site can’t be reachedlocalhost
refused to connect.
your container's external mapped port
http://localhost:8080/
This site can’t be reached
localhost refused to connect.
Checking logs I see : $ docker logs --tail=40 vtasks_web
<s> [webpack.Progress] 87% after chunk id optimization
<s> [webpack.Progress] 87% record modules
<s> [webpack.Progress] 87% record modules RecordIdsPlugin
<s> [webpack.Progress] 87% record chunks
<s> [webpack.Progress] 87% record chunks RecordIdsPlugin
<s> [webpack.Progress] 88% hashing
<s> [webpack.Progress] 88% after hashing
<s> [webpack.Progress] 88% after hashing HotModuleReplacementPlugin
<s> [webpack.Progress] 89% record hash
<s> [webpack.Progress] 89% module assets processing
<s> [webpack.Progress] 90% chunk assets processing
<s> [webpack.Progress] 90% additional chunk assets processing
<s> [webpack.Progress] 90% additional chunk assets processing HotModuleReplacementPlugin
<s> [webpack.Progress] 91% recording
<s> [webpack.Progress] 91% recording HotModuleReplacementPlugin
<s> [webpack.Progress] 92% additional asset processing
<s> [webpack.Progress] 92% chunk asset optimization
<s> [webpack.Progress] 93% after chunk asset optimization
<s> [webpack.Progress] 93% asset optimization
<s> [webpack.Progress] 94% after asset optimization
<s> [webpack.Progress] 94% after seal
<s> [webpack.Progress] 95% emitting
<s> [webpack.Progress] 95% emitting HtmlWebpackPlugin
<s> [webpack.Progress] 95% emitting CopyPlugin
<s> [webpack.Progress] 98% after emitting
<s> [webpack.Progress] 98% after emitting CopyPlugin
DONE Compiled successfully in 11638ms12:10:15 PM
<s> [webpack.Progress] 100%
App running at:
- Local: http://localhost:8080/
It seems you are running Vue CLI inside a container.
Access the dev server via http://localhost:<your container's external mapped port>/
Note that the development build is not optimized.
To create a production build, run npm run build.
ports:
- "8088:80"
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
99bc972f0840 ebiven/vue-cli "docker-php-entrypoi" 32 hours ago Up 8 minutes 0.0.0.0:8088->80/tcp vtasks_web
fcb6d879effa adminer "entrypoint.sh docke" 2 weeks ago Up 8 minutes 0.0.0.0:8089->8080/tcp vtasks_adminer
b0b81c6587bb mysql:5.7.28 "docker-entrypoint.s" 2 weeks ago Restarting (1) 47 seconds ago vtasks_db
最佳答案
您需要为 node_modules
创建一个“命名卷”。目录和 dist
目录,这样这些目录就不会被您的绑定(bind)挂载覆盖(这个东西:${APP_PATH_HOST}:${APP_PTH_CONTAINER}
)。
This教程解释得更好:
The second is a named volume,
node_modules
. When Docker runs thenpm install
instruction listed in the applicationDockerfile
,npm
will create a newnode_modules
directory on the container that includes the packages required to run the application. The bind mount we just created will hide this newly creatednode_modules
directory, however. Sincenode_modules
on the host is empty, the bind will map an empty directory to the container, overriding the newnode_modules
directory and preventing our application from starting. The namednode_modules
volume solves this problem by persisting the contents of the/home/node/app/node_modules
directory and mounting it to the container, hiding the bind.
web
下添加两个新卷。服务并将它们添加到
volumes
下在您的
docker-compose.yml
底部也:
web:
volumes:
- ${APP_PATH_HOST}:${APP_PTH_CONTAINER}
- node_modules:${APP_PTH_CONTAINER}/node_modules
- dist:${APP_PTH_CONTAINER}/dist
volumes:
node_modules:
dist:
Dockerfile
:
FROM node:lts-alpine
# install simple http server for serving static content
RUN npm install --quiet -g http-server
# install the vue-cli
RUN npm install --quiet --global \
@vue/cli
# create app directory
RUN mkdir /app
# copy both 'package.json' and 'package-lock.json' (if available)
COPY package*.json /app/
# copy project files and folders to the current working directory (i.e. 'app' folder)
COPY . /app/
# make the 'app' folder the current working directory
WORKDIR /app
# install project dependencies
RUN npm install
# build the app
RUN npm run build
docker-compose.yml
:
version: '3'
services:
web:
build:
context: .
dockerfile: Dockerfile
volumes:
- .:/app
- node_modules:/app/node_modules
- dist:/app/dist
ports:
- "8080:8080"
# uncomment command below to run development version
# command: "npm run serve"
command: "http-server dist"
volumes:
node_modules:
dist:
docker-compose up
然后我的应用程序在
http://localhost:8080/
可用.
Dockerfile
后第一次,一定要重建容器,例如
docker-compose up --build
.
关于docker - docker simple index.html下运行vue/cli app打开,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59491055/
如果我调用一个应用程序两次或多次,但只有一个实例应该运行(这是所需的),我就会遇到一个问题。 首先一些(可能必要的)背景信息: 使用 MAC OS X El Capitan (10.11.6) 我有一
覆盖文件。覆盖 Apps 脚本文件。 这是不是 创建一个新的 Apps 脚本文件的问题。那对我没有帮助。我需要更新 现有的 Apps 脚本文件。这个问题类似于创建一个新文件,但不是同一个问题。更新的语
我是 Apps 脚本的新手,正在尝试了解使用另一个帐户在一个帐户中运行/触发脚本的基础知识。需要注意的是:我想在访问脚本的用户而不是拥有脚本的用户的情况下运行脚本——以便将运行时间分配给访问的用户。
我是 Apps 脚本的新手,正在尝试了解使用另一个帐户在一个帐户中运行/触发脚本的基础知识。需要注意的是:我想在访问脚本的用户而不是拥有脚本的用户的情况下运行脚本——以便将运行时间分配给访问的用户。
我有一个安卓应用程序。我想为我的应用程序实现 App Indexing。 我已经点击了 Google 开发者链接 https://developers.google.com/app-indexing/
有什么区别: import App from '../components/App'; 和 var App = require('../components/App'); 两者都用于获取组件,但它没有
问题: 我有一个使用 requireJS 的简单演示应用程序。当require.min.js脚本加载时,它尝试加载入口点脚本。但是,问题是,而不是 localhost:8090/js/app.js它尝
我正在构建一个 React Native 应用程序,目前正在尝试通过 Firebase Auth 实现一个身份验证注册系统。我已经按照指南/网站上的文档来设置 Firebase 配置文件。我运行该应用
因此 app.yaml 文件的一部分如下所示(至少在 GAE 教程中): handlers: - url: /.* script: main.app 但是,我也看到它看起来像这样: handler
我是Android App开发的新手。当我尝试创建一个新项目Android Project时,弹出以下消息: Information:Gradle tasks [:app:generateDebugS
我正在编写一个应用程序脚本(用于处理电子邮件、任务和日历事件)并希望将其部署为网络应用程序。 该应用程序将在运行它的用户的上下文中运行。该应用程序将被超过 10k+ 的用户使用,甚至可能更多。 在将其
我需要实现一个用于登录网站的 Google Apps 脚本应用,然后如果该网站上的身份验证过程成功,用户应该会在 google 脚本边栏中收到一条消息。 例如:用户输入他的邮箱和密码,然后他点击登录按
我正在开发一个跨平台应用程序,它将在 Google Play 商店和 App Store 上发布。 Google Play 政策以及 App Store 政策规定,您不能使用其他支付系统购买将在应用程
我的 AppEngine 应用程序在我的台式机上的开发服务器上运行良好,但我无法在 Google 服务器上获取版本以关注我的源代码更新。 这是最有说服力的例证。我的 app.yaml 文件开始于: a
我像这样将所有内容重定向到我的 app.yaml 中的单个文件 - url: /.* script: frontcontroller.application 但我仍然必须使用 robots.txt
我想构建一个基于 App Engine 的网络应用程序,并使用 Google 帐户对用户进行身份验证。我需要来自多个域的用户可以登录。从我读到的内容看来,仅使用 Google Accounts API
我无法将我的域指向我使用 Google App Engine 托管的网站。这是背景……注意区分“google apps”(域托管、电子邮件等)和“google app engine”(网站框架)的概念
是否可以通过 App Engine 上内置的 OpenId 实现单点登录?我一直在尝试集成一个 Marketplace 应用程序,并让用户在来自 Google Apps(管理面板或通用导航)时登录。我
有没有办法从 azure-cli 为 Web 应用或函数应用创建和/或激活 App Insights? 现在浏览文档。 最佳答案 我之前也考虑过你的问题。要创建应用程序洞察力,az resource
我在以 Angular 创建新项目时遇到问题。当我运行 ng new myapp 命令时,我得到以下命令 ng 新问候语 Error: Path "/app/app.module.ts" does n
我是一名优秀的程序员,十分优秀!