Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dokcer build 没报错,但是没有 #60

Open
matthuo333 opened this issue Apr 18, 2023 · 10 comments
Open

Dokcer build 没报错,但是没有 #60

matthuo333 opened this issue Apr 18, 2023 · 10 comments
Labels
bug Something isn't working

Comments

@matthuo333
Copy link

Describe the bug

改了Dockfile 中的nginx监听端口,然后执行docker build, 出现如下后,检查结果没有image.

docker build . -t speechgpt --network host
[+] Building 1213.7s (13/15)
=> [internal] load .dockerignore 0.0s
=> => transferring context: 206B 0.0s
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 932B 0.0s
=> [internal] load metadata for docker.io/library/nginx:alpine 1.7s
=> [internal] load metadata for docker.io/library/node:alpine 1.7s
=> [builder 1/6] FROM docker.io/library/node:alpine@sha256:53741c7511b1836b5eb7e788a7b399c058b0b549f205d2c6af831ec1a9a81c31 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 9.23kB 0.0s
=> [stage-1 1/4] FROM docker.io/library/nginx:alpine@sha256:dd2a9179765849767b10e2adde7e10c4ad6b7e4d4846e6b77ec93f080cd2db27 0.0s
=> CACHED [builder 2/6] WORKDIR /app 0.0s
=> CACHED [builder 3/6] COPY package.json yarn.lock ./ 0.0s
=> CACHED [builder 4/6] RUN yarn install 0.0s
=> CACHED [builder 5/6] COPY . . 0.0s
=> CACHED [stage-1 2/4] COPY nginx.conf /etc/nginx/nginx.conf 0.0s
=> CACHED [stage-1 3/4] WORKDIR /usr/share/nginx/html 0.0s
=> [builder 6/6] RUN yarn build 1364.3s
=> => # yarn run v1.22.19
=> => # $ tsc && vite build

Steps to reproduce

步骤同上

Screenshots or additional context

No response

@matthuo333 matthuo333 added the bug Something isn't working label Apr 18, 2023
@erbanku
Copy link

erbanku commented Apr 18, 2023

请问Nginx端口改成多少了的呢?我修改一下,然后Build试试。
如果没有特殊需求,也可以用我 Build 的 Docker Image 试试。

Package speechgpt

docker pull ghcr.io/erbanku/speechgpt:0.4.0
Solution generated by GPT-4

It seems that the docker build process is stuck at the "yarn build" step, which is taking a long time to complete. This could be due to various reasons, such as insufficient resources on your machine, network issues, or the build process itself taking a long time.

To troubleshoot the issue, you can try the following steps:

  1. Check if there are any resource constraints on your machine, such as high CPU or memory usage. If so, try closing unnecessary applications or increasing the resources allocated to Docker.
  2. Check your network connection and make sure it is stable. Network issues might cause the build process to take longer than expected.
  3. Inspect the build process itself. You can try running the build command (yarn build) outside of Docker to see if it takes a similarly long time to complete. If it does, you might need to optimize the build process or investigate any issues with the build configuration.
  4. Check for any error messages in the build output. If there are any errors, they might provide clues as to why the build is not completing successfully.
  5. If the build is still not completing, you can try running the docker build command with the --no-cache option to force a clean build. This might help resolve any issues with cached layers:
docker build --no-cache . -t speechgpt --network host

If none of these steps resolve the issue, you might need to investigate further by looking into the specific build process and configuration for your project.

@matthuo333
Copy link
Author

改成了 48080

@erbanku
Copy link

erbanku commented Apr 18, 2023

改成了 48080

我这边没有遇到问题,修改 Nginx 端口后也 Build 成功了,可能是系统环境配置的问题。

修改后 Build 的 Image,可以拿去用:Package speechgpt-a

docker pull ghcr.io/erbanku/speechgpt-a:latest

Nginx 端口修改 - 48080

image

Build 成功

image

@matthuo333
Copy link
Author

多谢了! 先暂时用官方提供image, 不过运行后出现 “Error with builtin speech recognition”, 然后放行浏览器对于mirophone的block , 刷新后又限制。

@matthuo333
Copy link
Author

如果访问的端口不是ssl 或tls 是不能允许开启mirophone

@matthuo333
Copy link
Author

看来又必须重新build了

@matthuo333
Copy link
Author

我重新安装docker后,貌似还不是不行。你的Dockerfile 能分享下?

@erbanku
Copy link

erbanku commented Apr 19, 2023

我重新安装docker后,貌似还不是不行。你的Dockerfile 能分享下?

Dockerfile

FROM node:alpine as builder

ARG VITE_OPENAI_API_KEY=REPLACE_WITH_YOUR_OWN
ARG VITE_OPENAI_HOST=REPLACE_WITH_YOUR_OWN
ARG VITE_AWS_REGION=REPLACE_WITH_YOUR_OWN
ARG VITE_AWS_ACCESS_KEY_ID=REPLACE_WITH_YOUR_OWN
ARG VITE_AWS_ACCESS_KEY=REPLACE_WITH_YOUR_OWN
ARG VITE_AZURE_REGION=REPLACE_WITH_YOUR_OWN
ARG VITE_AZURE_KEY=REPLACE_WITH_YOUR_OWN

ENV VITE_OPENAI_API_KEY=$VITE_OPENAI_API_KEY \
    VITE_OPENAI_HOST=$VITE_OPENAI_HOST \
    VITE_AWS_REGION=$VITE_AWS_REGION \
    VITE_AWS_ACCESS_KEY_ID=$VITE_AWS_ACCESS_KEY_ID \
    VITE_AWS_ACCESS_KEY=$VITE_AWS_ACCESS_KEY \
    VITE_AZURE_REGION=$VITE_AZURE_REGION \
    VITE_AZURE_KEY=$VITE_AZURE_KEY

WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn install
COPY . .
RUN yarn build

FROM nginx:alpine
COPY nginx.conf /etc/nginx/nginx.conf
WORKDIR /usr/share/nginx/html
COPY --from=builder /app/dist .
ENTRYPOINT ["nginx", "-g", "daemon off;"]

@erbanku
Copy link

erbanku commented Apr 19, 2023

建议用干净的 linux 系统(VPS之类的)来 Build,这样你会很少遇到奇怪的问题。

@matthuo333
Copy link
Author

换了个Centos 系统,没问题了。 但是,在需要对容器加入ssl时候遇到问题。
下面是修改后的nginx配置,同时也在Dockerfile中加入了导入证书的COPY

但最后需要先运行 xxx.com:[80mapping port], 然后再运行 xxx.com:[443mapping port], 这样才OK,请大神看看什么原因呢?

worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
server {
listen 443 ssl;
server_name xxx.com;

    ssl_certificate /etc/ssl/certs/xxx.cer;
    ssl_certificate_key /etc/ssl/private/xxxx.key;

    location / {
        root /usr/share/nginx/html;
        index index.html index.htm;
        try_files $uri $uri/ /index.html;
    }
}

server {
    listen 80;
    server_name xxx.com;
    return 301 https://$host$request_uri;
}

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants