Ошибка при создании образа при запуске хранилища dockerhub, но без проблем собирается локально - PullRequest
1 голос
/ 04 апреля 2019

Я начал новый проект Vue, построенный на Vue CLI. Я хочу использовать докер, и у меня нет проблем с созданием образа локально на моей машине. Проблема возникает, когда я помещаю свой код в свой репозиторий, который затем запускает сборку в dockerhub. Dockerhub работает до шага 7/9, где предполагается запускать сборку npm. Сборка завершается с ошибкой:

This relative module was not found:
    * ./src/main.ts in multi ./src/main.ts ERROR Build failed with errors.

Полный журнал ошибок ниже:

Building for production... Starting type checking and linting service... Using 1 worker with 2048MB memory limit ERROR Failed to compile with 1 errors4:57:48 PM This relative module was not found:
* ./src/main.ts in multi ./src/main.ts ERROR Build failed with errors. npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! frontend@0.1.0 build: `vue-cli-service build` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the frontend@0.1.0 build script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2019-04-04T16_57_48_179Z-debug.log Removing intermediate container 993eab310ea3 The command '/bin/sh -c npm run build' returned a non-zero code: 1 

Вопросы, которые мне остались от этого:

  1. Что означает строка "* ./src/main.ts в multi ./src/main.ts"?
  2. И как мне это исправить?

Я также попытался запустить сборку изображений в облаке Google, просто чтобы посмотреть, не возникла ли проблема с совместным использованием меня и dockerhub, но Google вернул ошибку с той же ошибкой.

//Dockerfile
FROM node:lts-alpine

# install simple http server for serving static content
RUN npm install -g http-server

# make the 'app' folder the current working directory
WORKDIR /src

# copy both 'package.json' and 'package-lock.json' (if available)
COPY package*.json ./

# install project dependencies
RUN npm install

# copy project files and folders to the current working directory (i.e. 'app' folder)
COPY . .

# build app for production with minification
RUN npm run build

EXPOSE 8080
CMD [ "http-server", "dist" ]


//tsconfig.json
{
  "compilerOptions": {
    "outDir": "./built/",
    "target": "esnext",
    "module": "esnext",
    "strict": true,
    "jsx": "preserve",
    "importHelpers": true,
    "moduleResolution": "node",
    "experimentalDecorators": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "sourceMap": true,
    "baseUrl": ".",
    "types": [
      "webpack-env"
    ],
    "paths": {
      "@/*": [
        "src/*"
      ]
    },
    "lib": [
      "esnext",
      "dom",
      "dom.iterable",
      "scripthost"
    ]
  },
  "include": [
    "src/**/*.ts",
    "src/**/*.tsx",
    "src/**/*.vue",
    "tests/**/*.ts",
    "tests/**/*.tsx"
  ],
  "exclude": [
    "node_modules"
  ]
}


//main.ts
import Vue from 'vue';
import App from './App.vue';
import router from './router';
import store from './store';

Vue.config.productionTip = false;

new Vue({
  router,
  store,
  render: (h) => h(App),
}).$mount('#app');

Изображение структуры моего проекта

Я надеюсь, что включил правильную информацию, чтобы помочь вам, помочь мне.

...