Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a dockerfile #56

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Add a dockerfile #56

wants to merge 3 commits into from

Conversation

lucyydotp
Copy link

@lucyydotp lucyydotp commented Jun 3, 2021

Adds a Dockerfile to allow running Dis4IRC in a Docker container. I'm more than happy to publish this on docker hub when it's finished.

To use, clone the repo, docker build . then docker run -v /path/to/dir/containing/config:/srv/config <container id>.

Fixes #55

@zachbr
Copy link
Owner

zachbr commented Jun 3, 2021

Hi, thanks for taking a look at this.

My main concern so far is that it looks like it always pulls down the master branch and compiles from that. While I do try and keep master in a state where it is always running, it seems less than ideal to always be distributing that via docker. I can understand that it could also be tedious to keep bumping the docker image on every minor release as well. Is there perhaps a way to make it always fetch the latest release tag and compile that instead?

It seems like there are ways to get the latest git tag from the git CLI, is that something that would fit better do you think?

Dockerfile Outdated Show resolved Hide resolved
@lucyydotp
Copy link
Author

My main concern so far is that it looks like it always pulls down the master branch and compiles from that.

The dockerfile itself isn't responsible for obtaining source, it just builds what you have locally. Realistically, for deployment, you'd use a CI server and build on release (which I'm more than happy to set up on my TC instance if needed).

@zachbr
Copy link
Owner

zachbr commented Jun 5, 2021

Thanks. That makes sense but I’m (obviously) not overly familiar with docker. I suppose I should’ve made that connection myself given the lack of any “pull” action in the docker file.

I have my own TC instance we would probably want to use to maintain releases, but I’d love to see a test version using your instance if it isn’t too much trouble.

kash’s comments about multiple jars should probably be addressed as well. Right now there is always one shaded artifact on build but I imagine we shouldn’t necessarily assume that either. As a docker noob I look forward to your input.

@lucyydotp
Copy link
Author

I’d love to see a test version using your instance if it isn’t too much trouble.

Yeah that's fine, I can do that.

kash’s comments about multiple jars should probably be addressed as well.

I am trying my best here, but Docker is notoriously bad for getting the output of commands into variables that I could then use to get the project version. I have an idea for a shell workaround, I'll try it and let you know.

@lucyydotp
Copy link
Author

Turns out you don't even need a CI server, docker hub will do it all for you. This config will create images any time a new tag is created, creating a Docker tag for it, and also maintains the unstable tag with the latest commit.
image

@lucyydotp lucyydotp marked this pull request as ready for review June 5, 2021 11:29
@lucyydotp lucyydotp requested a review from kashike June 5, 2021 11:29
@lucyydotp
Copy link
Author

@raws1
Copy link

raws1 commented Sep 19, 2024

Any chance you'd pick this back up @lucyydotp?

@lucyydotp
Copy link
Author

lucyydotp commented Sep 19, 2024

Any chance you'd pick this back up @lucyydotp?

Gonna be honest with ya I have not used this since I made this pr more than 3 years ago :’)

I see no reason why the dockerfile I wrote would’ve broken though, I can pull quickly to test if wanted

(edit: docker hub had some kinda controversial pricing changes in 2022, maintainers you may want to consider publishing to github’s own registry instead)

@ilyagr
Copy link

ilyagr commented Nov 1, 2024

I'm not a Docker expert, but here's a Dockerfile that seems to work fine for me. It assumes you downloaded the jar file for Dis4IRC. (I considered putting a wget command inside the Dockerfile, but decided that would only make it less reliable).

FROM eclipse-temurin:23-jre-alpine
RUN mkdir /opt/app
COPY Dis4IRC-1.6.3.jar /opt/app
COPY config.hocon /opt/app
WORKDIR /opt/app
CMD ["java", "-jar", "Dis4IRC-1.6.3.jar"]

It's based on the docs from https://hub.docker.com/_/eclipse-temurin/, see there for many, many more options. In particular, if you want to do anything fancier, you might want the normal eclipse-temurin:23 image which is a bit larger (a whole 250MB, I think, the horror!) but includes Debian, apk, and a JDK instead of just a Java runtime. Or you can use jlink instead of a jre.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Docker support
5 participants