Skip to content

Commit

Permalink
Consolidate dockerfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
Syriiin committed Apr 25, 2024
1 parent 2d381a4 commit 6fc7a54
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 104 deletions.
25 changes: 0 additions & 25 deletions Difficalcy.Catch/Dockerfile

This file was deleted.

25 changes: 0 additions & 25 deletions Difficalcy.Mania/Dockerfile

This file was deleted.

25 changes: 0 additions & 25 deletions Difficalcy.Osu/Dockerfile

This file was deleted.

25 changes: 0 additions & 25 deletions Difficalcy.Taiko/Dockerfile

This file was deleted.

50 changes: 50 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
FROM mcr.microsoft.com/dotnet/aspnet:8.0-jammy-chiseled AS base

LABEL org.opencontainers.image.source https://github.com/Syriiin/difficalcy

WORKDIR /app
EXPOSE 80
ENV ASPNETCORE_URLS=http://+:80
ENV ASPNETCORE_ENVIRONMENT=Production
ENV BEATMAP_DIRECTORY=/app/beatmaps

FROM mcr.microsoft.com/dotnet/sdk:8.0-jammy AS build
WORKDIR /src

COPY ./Difficalcy/Difficalcy.csproj ./Difficalcy/
COPY ./Difficalcy.Catch/Difficalcy.Catch.csproj ./Difficalcy.Catch/
COPY ./Difficalcy.Mania/Difficalcy.Mania.csproj ./Difficalcy.Mania/
COPY ./Difficalcy.Osu/Difficalcy.Osu.csproj ./Difficalcy.Osu/
COPY ./Difficalcy.Taiko/Difficalcy.Taiko.csproj ./Difficalcy.Taiko/

RUN dotnet restore ./Difficalcy.Catch/Difficalcy.Catch.csproj
RUN dotnet restore ./Difficalcy.Mania/Difficalcy.Mania.csproj
RUN dotnet restore ./Difficalcy.Osu/Difficalcy.Osu.csproj
RUN dotnet restore ./Difficalcy.Taiko/Difficalcy.Taiko.csproj

COPY ./Difficalcy/ ./Difficalcy/
COPY ./Difficalcy.Catch/ ./Difficalcy.Catch/
COPY ./Difficalcy.Mania/ ./Difficalcy.Mania/
COPY ./Difficalcy.Osu/ ./Difficalcy.Osu/
COPY ./Difficalcy.Taiko/ ./Difficalcy.Taiko/

RUN dotnet publish ./Difficalcy.Catch/Difficalcy.Catch.csproj -o /app/difficalcy-catch --runtime linux-x64 --self-contained false
RUN dotnet publish ./Difficalcy.Mania/Difficalcy.Mania.csproj -o /app/difficalcy-mania --runtime linux-x64 --self-contained false
RUN dotnet publish ./Difficalcy.Osu/Difficalcy.Osu.csproj -o /app/difficalcy-osu --runtime linux-x64 --self-contained false
RUN dotnet publish ./Difficalcy.Taiko/Difficalcy.Taiko.csproj -o /app/difficalcy-taiko --runtime linux-x64 --self-contained false

FROM base AS difficalcy-catch
COPY --from=build /app/difficalcy-catch .
ENTRYPOINT ["dotnet", "Difficalcy.Catch.dll"]

FROM base AS difficalcy-mania
COPY --from=build /app/difficalcy-mania .
ENTRYPOINT ["dotnet", "Difficalcy.Mania.dll"]

FROM base AS difficalcy-osu
COPY --from=build /app/difficalcy-osu .
ENTRYPOINT ["dotnet", "Difficalcy.Osu.dll"]

FROM base AS difficalcy-taiko
COPY --from=build /app/difficalcy-taiko .
ENTRYPOINT ["dotnet", "Difficalcy.Taiko.dll"]
8 changes: 4 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ services:
difficalcy-osu:
build:
context: .
dockerfile: ./Difficalcy.Osu/Dockerfile
target: difficalcy-osu
environment:
- REDIS_CONFIGURATION=cache:6379
volumes:
Expand All @@ -13,7 +13,7 @@ services:
difficalcy-taiko:
build:
context: .
dockerfile: ./Difficalcy.Taiko/Dockerfile
target: difficalcy-taiko
environment:
- REDIS_CONFIGURATION=cache:6379
volumes:
Expand All @@ -24,7 +24,7 @@ services:
difficalcy-catch:
build:
context: .
dockerfile: ./Difficalcy.Catch/Dockerfile
target: difficalcy-catch
environment:
- REDIS_CONFIGURATION=cache:6379
volumes:
Expand All @@ -35,7 +35,7 @@ services:
difficalcy-mania:
build:
context: .
dockerfile: ./Difficalcy.Mania/Dockerfile
target: difficalcy-mania
environment:
- REDIS_CONFIGURATION=cache:6379
volumes:
Expand Down

0 comments on commit 6fc7a54

Please sign in to comment.