fix: serval bugs

This commit is contained in:
Simon Ding
2024-07-12 13:35:37 +08:00
parent 76bf358de7
commit cfa6d2d54c
7 changed files with 79 additions and 40 deletions

View File

@@ -1,31 +1,9 @@
FROM ubuntu:20.04 as flutter_build
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get install -y curl git wget unzip libgconf-2-4 gdb libstdc++6 libglu1-mesa fonts-droid-fallback python3
RUN apt-get clean
# download Flutter SDK from Flutter Github repo
RUN git clone https://github.com/flutter/flutter.git /usr/local/flutter
# Set flutter environment path
ENV PATH="/usr/local/flutter/bin:/usr/local/flutter/bin/cache/dart-sdk/bin:${PATH}"
# Run flutter doctor
RUN flutter doctor
# Enable flutter web
RUN flutter channel stable
RUN flutter upgrade
RUN flutter config --enable-web
# Copy files to container and build
RUN mkdir /app/
COPY . /app/
WORKDIR /app/
RUN flutter build web
FROM instrumentisto/flutter:3 AS flutter
WORKDIR /app
COPY ./ui/pubspec.yaml ./ui/pubspec.lock ./
RUN flutter pub get
COPY ./ui/ ./
RUN flutter build web
# 打包依赖阶段使用golang作为基础镜像
@@ -37,14 +15,15 @@ ENV GO111MODULE=on \
WORKDIR /app
COPY --from=flutter_build go.mod .
COPY --from=flutter_build go.sum .
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY --from=flutter_build . .
COPY . .
COPY --from=flutter /app/build/web ./ui/build/web/
# 指定OS等并go build
RUN GOOS=linux GOARCH=amd64 go build -o polaris ./cmd/
RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -o polaris ./cmd/
FROM debian:12