Я пытаюсь создать vue. js spa в среде docker, но команда "vue -cli-service build" продолжает терпеть неудачу. Это немного расстраивает, потому что здание для производства без docker работает. Также я могу успешно запустить "vue -cli-service serve" в моей среде docker.
Я довольно плохо знаком с Docker и не знаю, с чего начать.
Вот файл docker:
FROM node:latest
RUN apt-get update && apt-get -y upgrade && DEBIAN_FRONTEND=noninteractive apt-get -y install \
apache2 curl nano git-all
RUN a2enmod rewrite
RUN a2enmod headers
ENV APACHE_RUN_USER www-data
ENV APACHE_RUN_GROUP www-data
ENV APACHE_LOG_DIR /var/log/apache2
ENV APACHE_LOCK_DIR /var/lock/apache2
ENV APACHE_PID_FILE /var/run/apache2.pid
EXPOSE 80
RUN apt-get install supervisor -y
ADD config/front-spa/apache.conf /etc/apache2/sites-enabled/000-default.conf
ADD config/front-spa/supervisord.conf /etc/supervisord.conf
ADD config/front-spa/start.sh /home/start.sh
RUN chmod +x /home/start.sh
Вот мой docker - composer .yml:
version: "3.1"
services:
front-spa:
build:
context: .
dockerfile: Dockerfile
restart: always
ports:
- "xxxx:xxxx"
- "xxxx:xxxx"
environment:
GIT_URL: https://[GIT_USER]:[GIT_PASS]@bitbucket.org/[...].git
SUPERVISOR_USER: [SUPERVISOR_USER]
SUPERVISOR_PASS: [SUPERVISOR_PASS]
BASE_URL: http://127.0.0.1:xxxx
BASE_URL_API: http:127.0.0.1:xxxx
entrypoint: ./home/start.sh
Вот начало точки входа. sh:
#!/bin/bash
sed -i "s|SUPERVISOR_USER|${SUPERVISOR_USER}|g" /etc/supervisord.conf
sed -i "s|SUPERVISOR_PASS|${SUPERVISOR_PASS}|g" /etc/supervisord.conf
mkdir /var/www/site
cd /var/www/site
git clone ${GIT_URL} .
sed -i "s|http://localhost:5000|${BASE_URL_API}|g" /var/www/site/src/api.js
sed -i "s|BASE_URL|${BASE_URL_API}|g" /var/www/site/public/index.html
npm i
npm run build
/usr/bin/supervisord --configuration=/etc/supervisord.conf
И, наконец, трассировка стека:
- Building for production...
front-spa_1 | ERROR Failed to compile with 1 errors12:56:09 PM
front-spa_1 |
front-spa_1 | Error: Child compilation failed:
front-spa_1 | Module build failed (from ./node_modules/html-webpack-plugin/lib/loader.js):
front-spa_1 | SyntaxError: Unexpected token ':'
front-spa_1 |
front-spa_1 | - Function
front-spa_1 |
front-spa_1 | - lodash.js:14870
front-spa_1 | [site]/[lodash]/lodash.js:14870:16
front-spa_1 |
front-spa_1 | - lodash.js:473 apply
front-spa_1 | [site]/[lodash]/lodash.js:473:27
front-spa_1 |
front-spa_1 | - lodash.js:15254
front-spa_1 | [site]/[lodash]/lodash.js:15254:16
front-spa_1 |
front-spa_1 | - lodash.js:475 apply
front-spa_1 | [site]/[lodash]/lodash.js:475:27
front-spa_1 |
front-spa_1 | - lodash.js:6563
front-spa_1 | [site]/[lodash]/lodash.js:6563:16
front-spa_1 |
front-spa_1 | - lodash.js:14869 Function.template
front-spa_1 | [site]/[lodash]/lodash.js:14869:20
front-spa_1 |
front-spa_1 |
front-spa_1 | - SyntaxError: Unexpected token ':'
front-spa_1 |
front-spa_1 | - compiler.js:79
front-spa_1 | [site]/[html-webpack-plugin]/lib/compiler.js:79:16
front-spa_1 |
front-spa_1 | - Compiler.js:343
front-spa_1 | [site]/[webpack]/lib/Compiler.js:343:11
front-spa_1 |
front-spa_1 | - Compiler.js:681
front-spa_1 | [site]/[webpack]/lib/Compiler.js:681:15
front-spa_1 |
front-spa_1 |
front-spa_1 | - Hook.js:154 AsyncSeriesHook.lazyCompileHook
front-spa_1 | [site]/[tapable]/lib/Hook.js:154:20
front-spa_1 |
front-spa_1 | - Compiler.js:678
front-spa_1 | [site]/[webpack]/lib/Compiler.js:678:31
front-spa_1 |
front-spa_1 |
front-spa_1 | - Hook.js:154 AsyncSeriesHook.lazyCompileHook
front-spa_1 | [site]/[tapable]/lib/Hook.js:154:20
front-spa_1 |
front-spa_1 | - Compilation.js:1423
front-spa_1 | [site]/[webpack]/lib/Compilation.js:1423:35
front-spa_1 |
front-spa_1 |
front-spa_1 | - Hook.js:154 AsyncSeriesHook.lazyCompileHook
front-spa_1 | [site]/[tapable]/lib/Hook.js:154:20
front-spa_1 |
front-spa_1 | - Compilation.js:1414
front-spa_1 | [site]/[webpack]/lib/Compilation.js:1414:32
front-spa_1 |
front-spa_1 |
front-spa_1 | - task_queues.js:97 processTicksAndRejections
front-spa_1 | internal/process/task_queues.js:97:5
Заранее спасибо!