我正在尝试对 Vite React-Typescript 样板设置进行 dockerize,但无法连接到容器。
安装了 vite-react-typescript 样板:
npm init vite@latest vite-docker-demo -- --template react-ts
Dockerfile
# Declare the base image
FROM node:lts-alpine3.14
# Build step
# 1. copy package.json and package-lock.json to /app dir
RUN mkdir /app
COPY package*.json /app
# 2. Change working directory to newly created app dir
WORKDIR /app
# 3 . Install dependencies
RUN npm ci
# 4. Copy the source code to /app dir
COPY . .
# 5. Expose port 3000 on the …
Run Code Online (Sandbox Code Playgroud)