mirror of
https://github.com/DrizzleTime/Foxel.git
synced 2026-09-05 07:36:53 +08:00
feat(Docker): add EF Core migrations
This commit is contained in:
+5
-1
@@ -16,7 +16,10 @@ COPY ["Foxel.csproj", "./"]
|
|||||||
RUN dotnet restore "Foxel.csproj"
|
RUN dotnet restore "Foxel.csproj"
|
||||||
COPY . .
|
COPY . .
|
||||||
WORKDIR "/src/"
|
WORKDIR "/src/"
|
||||||
|
RUN dotnet tool install --global dotnet-ef
|
||||||
|
ENV PATH="${PATH}:/root/.dotnet/tools"
|
||||||
RUN dotnet build "./Foxel.csproj" -c $BUILD_CONFIGURATION -o /app/build
|
RUN dotnet build "./Foxel.csproj" -c $BUILD_CONFIGURATION -o /app/build
|
||||||
|
RUN dotnet ef migrations add InitialCreate
|
||||||
|
|
||||||
FROM build AS publish
|
FROM build AS publish
|
||||||
ARG BUILD_CONFIGURATION=Release
|
ARG BUILD_CONFIGURATION=Release
|
||||||
@@ -25,12 +28,13 @@ RUN dotnet publish "./Foxel.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:U
|
|||||||
FROM base AS final
|
FROM base AS final
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=publish /app/publish .
|
COPY --from=publish /app/publish .
|
||||||
|
COPY --from=build /src/Migrations /app/Migrations
|
||||||
RUN apt-get update && apt-get install -y nginx && rm -rf /var/lib/apt/lists/*
|
RUN apt-get update && apt-get install -y nginx && rm -rf /var/lib/apt/lists/*
|
||||||
COPY --from=build-frontend /src/Web/dist /var/www/html
|
COPY --from=build-frontend /src/Web/dist /var/www/html
|
||||||
COPY /Web/nginx.conf /etc/nginx/nginx.conf
|
COPY /Web/nginx.conf /etc/nginx/nginx.conf
|
||||||
|
|
||||||
RUN mkdir -p /var/lib/nginx/body /var/cache/nginx /var/run/nginx /app/Uploads \
|
RUN mkdir -p /var/lib/nginx/body /var/cache/nginx /var/run/nginx /app/Uploads \
|
||||||
&& chown -R $APP_UID:$APP_UID /var/lib/nginx /var/cache/nginx /var/run/nginx /var/log/nginx /etc/nginx /var/www/html /app/Uploads \
|
&& chown -R $APP_UID:$APP_UID /var/lib/nginx /var/cache/nginx /var/run/nginx /var/log/nginx /etc/nginx /var/www/html /app/Uploads /app/Migrations \
|
||||||
&& mkdir -p /run \
|
&& mkdir -p /run \
|
||||||
&& chmod 777 /run
|
&& chmod 777 /run
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user