Skip to content

我尝试在docker中创建一个镜像,编译成功了但是无法访问,有懂的大佬指点吗? #99

@wtfllix

Description

@wtfllix
Dockerfile:
# 使用 Node.js 的官方 Docker 镜像作为基础镜像
FROM node:latest

# 设置环境变量,例如设置时区,这里设置为 UTC
ENV TZ=UTC

# 设置工作目录
WORKDIR /usr/src/app

# 安装 pnpm,项目中提到需要 pnpm
RUN npm install -g pnpm

# 从 GitHub 仓库克隆项目到工作目录
RUN git clone https://github.com/visiky/resume.git /usr/src/app

# 切换到项目目录
WORKDIR /usr/src/app/resume

# 安装项目依赖
RUN pnpm install

# 如果项目需要暴露端口,则使用 EXPOSE 指令
EXPOSE 8000

# 定义启动命令,这里假设项目使用 npm start 启动
CMD ["npm", "start"]

启动日志:

2024-05-14 15:11:56 .3.4/node_modules/babel-plugin-lodash/lib/index.js:102:44)

You can now view resume in the browser.

http://localhost:8000/

View GraphiQL, an in-browser IDE, to explore your site's data and schema

http://localhost:8000/___graphql

Note that the development build is not optimized.
To create a production build, use gatsby build

success Building development bundle - 16.415s
2024-05-14 15:12:12

但访问8000端口是empty response ,端口已映射。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions