Comments (5)
Definitely something I wanted to pursue with this bot! Adding it to my to-do. :)
from flowabot.
I published a Dockerfile in the docker-test branch and put it on Docker Hub.
To run it first create a volume:
docker volume create --name flowabot
Then set up the docker container which will also lead you through the configuration wizard:
docker run --name flowabot --restart unless-stopped -it -v flowabot:/usr/src/app leaphant/flowabot
Now the bot can be stopped by pressing Ctrl+C and then started in the background with the following command:
docker start flowabot
If you (@ShaddyDC) or someone else knows more about Docker and can help me, as I've only just learned about it during the last two days, please comment on issues before I'll merge this. Thank you!
from flowabot.
So, I haven't got around to playing around with it, so I don't know which parts are exactly needed where, and what I'm saying is only what I got from looking it over without any actual testing or investigating. I also have to say that while I've worked with docker some, I'm probably not aware of a bunch of best practices.
I'm not sure if .net is required for actually running it or only for building. In the latter case I would suggest using a multi-stage build with the corresponding image. In that case you also wouldn't need the ENV variables anymore.
I think I've read somewhere about clearing the apt cache after doing your installations or removing the tools after they're not needed anymore to keep the image slim, but it isn't hugely important, at least to me. However, if it works, you could try using the node:10-alpine
image to make a significant difference in size.
You can save the WORKDIR /opt
line by directly using WORKDIR /opt/osu-tools
and then cloning into the current directory. Nothing much, but it makes the Dockerfile look more neat, imo.
Similarly, is there a specific reason you're using COPY twice? The second call would include all the files of the first one, so I'm not sure it's necessary. I don't know if it makes a difference in caching though.
You can also reorder some stuff for better caching of build stages, but I don't know which of those commands can be cached or any details from the top of my head, so I won't comment until I've played with it around some. I can properly look into it later this weekend or early next week.
from flowabot.
Alright, thanks for the insight. I'll play around with the Alpine image.
The .NET Core SDK could indeed be removed and replaced by the runtime after building osu-tools, this would make multi-stage builds even more complicated though so I'd rather keep it the current way even though it's a little messy.
The reason I run COPY twice like that is simply because I've seen it written that way in every Docker for Node.js example. 🤷
from flowabot.
Some small things. I've never worked with node.js, so I haven't really dug deep into it and can only give some superficial feedback.
Firstly it would be nice if the config file was detached form the bot folder. Then you could just take an empty local directory and use that as the volume, docker run -it --rm -v $PWD/flowabot:/config leaphant/flowabot
or whatever. This currently produces an error as the local folder overwrites whatever is inside the container folder, and in this case it would then lack the files to run the bot.
On that note, you also wouldn't want the entire bot to live in the volume. Docker is all about applications being ephemeral. Then running git pull on the volume to update also completely bypasses the docker version system. You only want to update by pulling the later version of the image manually. This would be especially true for tags, but I guess that isn't an issue in this case. lol
Having only the config persist would also allow to just swap out different versions of the bot, downgrade or temporarily run a dev test branch or whatever, and just plug the config volume in there.
There's also things like watchtower to do the updating automatically. These wouldn't work with this mechanism.
One more thing which is mostly for convenience, just throw the bot into /app
instead of /usr/src/app
. It's just shorter, and it's not like you've got other stuff in the container so you'd have to keep things orderly and stuff.
Some minor things: Maybe run apt-get clean
and rm -rf /var/lib/apt/lists/*
after the install to keep the image smaller, though I haven't checked how much that actually saves. Lastly, it's odd to have COPY origin .
and COPY origin ./
each once. Doesn't really matter though.
Edit: I just remembered, you could use oppai-ng instead of the osu tools to avoid the need for .net. I don't know how accurate it actually is, but it probably is accurate enough. It looks like it also supports star difficulty calculation. Though you've commented on an issue there, so you've probably got a reason for not using it.
from flowabot.
Related Issues (20)
- Error when starting the bot HOT 4
- Beatmap wont download
- Website is down or similar HOT 1
- !strains graph hard to view HOT 1
- Other gamemode commands HOT 1
- rendering osr directly from channel
- NC doesnt get recognized as DT HOT 1
- UnhandledPromiseRejectionWarning
- [email protected] is incompatible with nodejs<12.0.0 and flowabot needs lts-dubnium(10.x.x) to run HOT 2
- !render doesn't detect hidden mod HOT 1
- I can't setup bot HOT 1
- !with command won't work
- Can't use Twitch Client ID HOT 1
- Infinite rendering when provided negative percentage value HOT 1
- Wider !rs window HOT 1
- Video won't encoding HOT 1
- Disable @everyone for emote command
- [Bug] !render in channel that flowabot has never spoken in returns help prompt HOT 3
- Feature
- pp values when you run a command like -rs still using pre-rework values
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flowabot.