Когда я развертываю свое веб-приложение Vue.js в Cloud Run, кажется, что оно не загружается должным образом. Запуск контейнера локально или в Kubernetes Pod работает должным образом.
Это Dockerfile, который я использую:
# build stage
FROM node:lts-alpine as build-stage
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
# production stage
FROM nginx:stable-alpine as production-stage
COPY --from=build-stage /app/dist /usr/share/nginx/html
EXPOSE 80
CMD ["touch", "/var/log/ngingx/error.log"]
CMD ["touch", "/var/log/ngingx/access.log"]
CMD ["nginx", "-g", "daemon off;"]
локальный журнал сборки докеров: https://pastebin.com/1nGk2E5n
Журнал сборки докеров конвейера bitbucket: https://pastebin.com/d5wCj1vY
Сообщение об ошибке Cloud Run (фактический журнал запуска контейнера докеров):
Deploying container to Cloud Run for Anthos service [importer-controlroom-frontend-dev] in namespace [dev] of cluster [myApp-cluster-dev]
Deploying...
Creating Revision...................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................failed
Deployment failed
ERROR: (gcloud.run.deploy) Revision "importer-controlroom-frontend-dev-00003-tum" failed with message: Container failed with: /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: Getting the checksum of /etc/nginx/conf.d/default.conf
10-listen-on-ipv6-by-default.sh: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (2: No such file or directory)
2020/07/17 08:26:03 [emerg] 1#1: open() "/var/log/nginx/error.log" failed (2: No such file or directory)
.
Журнал развертывания локального контейнера докеров:
/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: Getting the checksum of /etc/nginx/conf.d/default.conf
10-listen-on-ipv6-by-default.sh: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
Итак, у меня два разных результата. Я несколько думаю, что Cloud Run по-другому обрабатывает nginx, и я также прочитал несколько статей в блогах об этом, но я просто не могу понять, как я могу запустить свое приложение без этой упомянутой проблемы.
CMD touch /var/log/ngingx/error.log && touch /var/log/ngingx/access.log && nginx -g daemon off;
- person guillaume blaquiere   schedule 17.07.2020