init
This commit is contained in:
32
client/Dockerfile
Normal file
32
client/Dockerfile
Normal file
@@ -0,0 +1,32 @@
|
||||
# 使用官方Flutter镜像作为构建环境
|
||||
FROM cirrusci/flutter:stable AS build
|
||||
|
||||
# 设置工作目录
|
||||
WORKDIR /app
|
||||
|
||||
# 复制pubspec文件
|
||||
COPY pubspec.yaml pubspec.lock ./
|
||||
|
||||
# 获取依赖
|
||||
RUN flutter pub get
|
||||
|
||||
# 复制源代码
|
||||
COPY . .
|
||||
|
||||
# 构建Web应用
|
||||
RUN flutter build web --release
|
||||
|
||||
# 使用nginx作为生产环境
|
||||
FROM nginx:alpine
|
||||
|
||||
# 复制构建产物到nginx目录
|
||||
COPY --from=build /app/build/web /usr/share/nginx/html
|
||||
|
||||
# 复制nginx配置
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
# 暴露端口
|
||||
EXPOSE 80
|
||||
|
||||
# 启动nginx
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
Reference in New Issue
Block a user