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

Docker container #24

Merged
merged 4 commits into from
Nov 17, 2021
Merged

Docker container #24

merged 4 commits into from
Nov 17, 2021

Conversation

AaronDewes
Copy link
Contributor

The docker images build, but haven't been tested yet.


This adds very early docker container support. Once you merge this PR, builds will automatically happen on every push and tag and will be pushed to GitHub container registry.

on:
push:
branches:
- main
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

main branch doesn't exist in this repository, so anyone could make an unprotected branch with push perms.

It should be removed, or a main branch should be created and protected.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bumi I'm not sure about your branch protection rules, does anyone without direct access to the main branch still have push access to this repo?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not a member of this project, but you can just look at their project branches and see that main doesn't exist.

In Github, you can't protect a branch that doesn't exist.

スクリーンショット 2021-10-28 16 18 41

Copy link
Owner

@bumi bumi Oct 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

secrets and such are not available to forks, so this will not be working when somebody forks the repo (which is what we want).

edit: but yeah, LnMe uses master and not main.

but I am also wondering if we need that on-push action? isn't it enough to do that for tags which then are the official releases?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm using an on push action myself, it's free to run, and it allows testing a new version in Docker (and maybe fixing new bugs only appearing in Docker) before tagging it.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we want to keep building on push, then we must change "main" to "master" (we still use master as the master/main branch)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It builds on both master and main, so it still works if you rename

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah I missed the master in the line below. sorry. thanks.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(though I have no plans to rename the branch and potentially break things.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, branch could be left out so it also builds for WIP feature branches for testing. What do you think?

@junderw
Copy link

junderw commented Oct 28, 2021

LGTM

Copy link

@junderw junderw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, this build should be conditional on the test suite passing.

This will prevent broken builds from being published.

Edit: No tests exist. Might want to fix that first.

@bumi
Copy link
Owner

bumi commented Oct 28, 2021

Yes, sadly that's a problem. at this point we do not have automated tests.
it's a tiny app but at least some basic integration specs must be added with adding more features.

@AaronDewes AaronDewes marked this pull request as ready for review October 28, 2021 14:57
@AaronDewes AaronDewes changed the title WIP: Docker container Docker container Oct 28, 2021
@AaronDewes
Copy link
Contributor Author

Tested & works.

Copy link
Owner

@bumi bumi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How are configuration options passed in? that would be done when running the container? e.g. through docker-compose?

@AaronDewes
Copy link
Contributor Author

Yes, options get passed in as env vars through docker-compose


COPY --from=builder /app/lnme /lnme

EXPOSE 1323
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the PORT can be configured... should this then also be configurable (based on the LNME_LISTEN env variable) or is it a practice to NOT change the default port when using docker?
(I am not very experienced with docker)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EXPOSE just exposes a port to other containers by default.

At runtime / in a higher level compose file you can expose and/or open-to-host any port you want.

This should be fine to use the default port. (It's semi-convention)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks! 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the docker documentation

The EXPOSE instruction does not actually publish the port. It functions as a type of documentation between the person who builds the image and the person who runs the container, about which ports are intended to be published.

@bumi
Copy link
Owner

bumi commented Nov 4, 2021

OK, I think this is cool.

I can then also do something like: docker run -it --rm ghcr.io/bumi/lnme:master correct?
could you add a note to the readme?

@AaronDewes
Copy link
Contributor Author

Sorry, I missed your comment. I'll add a note now.

@bumi
Copy link
Owner

bumi commented Nov 17, 2021

thanks so much! merging!

@bumi bumi merged commit 6f2b72c into bumi:master Nov 17, 2021
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.

3 participants