Skip to content

Commit

Permalink
Merge pull request #4 from Syriiin/fix/volume-permissions
Browse files Browse the repository at this point in the history
Switch back to alpine to fix volume permission issues
  • Loading branch information
Syriiin authored Apr 25, 2024
2 parents bb8e57a + 8da8673 commit b73991a
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 20 deletions.
1 change: 0 additions & 1 deletion Difficalcy/Services/WebBeatmapProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public class WebBeatmapProvider : IBeatmapProvider
public WebBeatmapProvider(IConfiguration configuration)
{
_beatmapDirectory = configuration["BEATMAP_DIRECTORY"];
Directory.CreateDirectory(_beatmapDirectory);
}

public async Task<bool> EnsureBeatmap(string beatmapId)
Expand Down
17 changes: 11 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
FROM mcr.microsoft.com/dotnet/aspnet:8.0-jammy-chiseled AS base
FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine3.19 AS base

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

USER app

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

VOLUME ${BEATMAP_DIRECTORY}
RUN mkdir ${BEATMAP_DIRECTORY}

FROM mcr.microsoft.com/dotnet/sdk:8.0-jammy AS build
WORKDIR /src
Expand All @@ -28,10 +33,10 @@ 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
RUN dotnet publish ./Difficalcy.Catch/Difficalcy.Catch.csproj -o /app/difficalcy-catch --runtime linux-musl-x64 --self-contained false
RUN dotnet publish ./Difficalcy.Mania/Difficalcy.Mania.csproj -o /app/difficalcy-mania --runtime linux-musl-x64 --self-contained false
RUN dotnet publish ./Difficalcy.Osu/Difficalcy.Osu.csproj -o /app/difficalcy-osu --runtime linux-musl-x64 --self-contained false
RUN dotnet publish ./Difficalcy.Taiko/Difficalcy.Taiko.csproj -o /app/difficalcy-taiko --runtime linux-musl-x64 --self-contained false

FROM base AS difficalcy-catch
LABEL org.opencontainers.image.description "Lazer powered osu!catch difficulty calculator API"
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ services:
environment:
- REDIS_CONFIGURATION=cache:6379
ports:
- "5000:80"
- 5000:80
volumes:
- beatmaps:/app/beatmaps
- beatmaps:/home/app/beatmaps
depends_on:
- cache
Expand Down
8 changes: 4 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
environment:
- REDIS_CONFIGURATION=cache:6379
volumes:
- beatmaps:/app/beatmaps
- beatmaps:/home/app/beatmaps
depends_on:
- cache

Expand All @@ -17,7 +17,7 @@ services:
environment:
- REDIS_CONFIGURATION=cache:6379
volumes:
- beatmaps:/app/beatmaps
- beatmaps:/home/app/beatmaps
depends_on:
- cache

Expand All @@ -28,7 +28,7 @@ services:
environment:
- REDIS_CONFIGURATION=cache:6379
volumes:
- beatmaps:/app/beatmaps
- beatmaps:/home/app/beatmaps
depends_on:
- cache

Expand All @@ -39,7 +39,7 @@ services:
environment:
- REDIS_CONFIGURATION=cache:6379
volumes:
- beatmaps:/app/beatmaps
- beatmaps:/home/app/beatmaps
depends_on:
- cache

Expand Down
12 changes: 6 additions & 6 deletions docs/docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ services:
environment:
- REDIS_CONFIGURATION=cache:6379
ports:
- "5000:80"
- 5000:80
volumes:
- beatmaps:/app/beatmaps
- beatmaps:/home/app/beatmaps
depends_on:
- cache

Expand Down Expand Up @@ -69,10 +69,10 @@ By default, the beatmap cache will be lost when the container is restarted, and

### Environment Variables

| Environment variable | Default | Description |
| --------------------- | --------------- | ---------------------------------------------------------- |
| `BEATMAP_DIRECTORY` | `/app/beatmaps` | The directory difficalcy uses for storing beatmap files |
| `REDIS_CONFIGURATION` | | The address of the redis server to use for beatmap caching |
| Environment variable | Default | Description |
| --------------------- | -------------------- | ----------------------------------------------------------------------------------------------- |
| `BEATMAP_DIRECTORY` | `/home/app/beatmaps` | The directory difficalcy uses for storing beatmap files. |
| `REDIS_CONFIGURATION` | | The address of the redis server to use for beatmap caching. By default, there will be no cache. |

## How to run a calculation

Expand Down
2 changes: 1 addition & 1 deletion tooling.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS base
FROM mcr.microsoft.com/dotnet/sdk:8.0-jammy AS base

RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
&& chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
Expand Down

0 comments on commit b73991a

Please sign in to comment.