MrStahlfelge / lightblocks

Falling Lightblocks. Falling block game for Android (Mobile and TV), iOS, Web browsers. Works on desktops, too.
https://www.golfgl.de/lightblocks/
Other
140 stars 15 forks source link

Added Docker build workflow #54

Open ChaosMarc opened 1 year ago

ChaosMarc commented 1 year ago

Thank you very much for this awsome app! My wife and I are constantly battling against each other for a few days now :)

As I'm about to host my own server to be more flexible and wanted to run it via Docker, I've decided to automate the Docker build process. This PR will automatically create and publish a Dockerimage for every github release you create. It will publish the two docker tags "latest" and "<the git tag name the release is based on>".

If you choose to integrate the PR, all you have to do before creating the next release is:

  1. Create an account at https://hub.docker.com/signup if you you haven't already
  2. Create a new access token with read/write/delete permissions at https://hub.docker.com/settings/security if you you haven't already
  3. Create a new repository called "lightblocks" (or whatever you want to call it, but then you have to update .github/workflows/release_server.yml:45 accordingly) at https://hub.docker.com/repository/create
  4. Add two Github Secrets DOCKERHUB_USERNAME and DOCKERHUB_TOKEN with the data from step 1 and 2 at https://github.com/MrStahlfelge/lightblocks/settings/secrets/actions

Kind regards Marc

MrStahlfelge commented 1 year ago

Hi and thanks for the contribution! Myself, I use dokku on docker and push the repository to the application added on dokku to run the server. I am not familiar with using docker in another way. Do you already use it the way it is configured in the prepared dockerfile?

ChaosMarc commented 1 year ago

Hey, sorry for the delay. Couldn't leave the bed for a few days as the nice little virus starting with a "C" nobody seems to be talking about anymore hit me pretty hard.

Yes, I'm already using the built image on my server. This is my docker compose config:

version: '2'

services:
  lightblocks:
    image: chaosmarc/lightblocks
    container_name: lightblocks
    volumes:
      - /opt/config/lightblocks/server.xml:/server.xml
    ports:
      - "8887:8887"
    restart: unless-stopped 

If I added the port to the Dockerfile I probably wouldn't have to define it in my docker compose config. I will test that either today or tomorrow depending on how my health progresses.

Afterthought: Note how I have to mount the server.xml file to / instead it /app were the jar file resides. I think this could be fixed by added /app to the class path. I will check that too.

ChaosMarc commented 1 year ago

Ok. I've fixed the app searching for server.xml in / and added the port exposure to the Dockerfile. From my side there isn't anything left I would change