Skip to content

Commit

Permalink
Merge pull request #94 from IzStriker/fix-k8s
Browse files Browse the repository at this point in the history
feat: works on my machine
  • Loading branch information
djpiper28 authored Feb 28, 2024
2 parents 06fac44 + 1e81522 commit 22652de
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 22 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
!/WakaBot
!/WakaBot.Core
!/WakaBot.Web
!/docker_start.sh

**/*~
**/*.log
Expand Down
16 changes: 11 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,23 @@ WORKDIR /app/WakaBot.Web
RUN dotnet restore
RUN dotnet publish -c Release -o /app/out

FROM ubuntu:latest
FROM mcr.microsoft.com/dotnet/aspnet:6.0
RUN apt-get update
RUN apt-get install -y aspnetcore-runtime-6.0
RUN apt-get install -y software-properties-common
RUN add-apt-repository contrib
RUN add-apt-repository non-free

RUN useradd -m app
WORKDIR /home/app/
RUN apt-get update
RUN apt-get install -y ttf-mscorefonts-installer

RUN mkdir /app

WORKDIR /app/

RUN chmod -R 600 .
COPY --from=build-env /app/out .
COPY --from=build-env /fonts .local/share/fonts
COPY appsettings.json .

EXPOSE 5000
ENV ASPNETCORE_URLS=http://0.0.0.0:5000/
ENTRYPOINT [ "dotnet", "WakaBot.Web.dll" ]
24 changes: 8 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,27 +62,19 @@ Requires the following permissions

### Docker

##### Create a `.env` file
```env-file
token=my discord token
runWebServer=true
ConnectionStrings:PostgreSql=Host=localhost;Port=changeme;Username=waka;Password=changeme;Database=waka
OAuth2:Name=WakaTime
OAuth2:ClientId=change me
OAuth2:ClientSecret=change me
OAuth2:AuthorizeUrl=https://wakatime.com/oauth/authorize
OAuth2:RedirectUrl=change me
OAuth2:TokenUrl=https://wakatime.com/oauth/token
databaseProvider=PostgreSql
```

##### Using it in Docker

Create a Dockerfile that copies in your appsettings:

```Dockerfile
FROM izstriker/wakabot
COPY appsettings.json .
```

```sh
docker build -t waka .
docker run waka
docker run -p 5000:5000 --volume --env-file .env waka
docker run -p 5000:5000 --rm -it waka
```

You will need to migrate your database with `dotnet ef database update --context WakaBot.Core.Data.PostgreSqlContext`
Expand Down

0 comments on commit 22652de

Please sign in to comment.