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 Docker image in release (#489) #590

Merged
merged 2 commits into from
Oct 15, 2021

Conversation

doniacld
Copy link
Contributor

@doniacld doniacld commented Oct 12, 2021

Description

Add a revive docker image to the generated artifacts when releasing with goreleaser.

How it has been tested

I tested manually the generation of the docker image as follow.

  1. Install goreleaser locally
  2. Dry-run the release locally

I followed the goreleaser quickstart.

[donia@localhost revive]$ goreleaser release --snapshot --rm-dist
 // removed previous logs to keep the interesting one
      • checksumming              file=revive_v1.1.2-next_Linux_arm64.tar.gz
      • checksumming              file=revive_v1.1.2-next_Windows_x86_64.tar.gz
   • docker images    
      • building docker image     image=ghcr.io/mgechev/revive:v1.1.2-next
      • pipe skipped              error=publishing is disabled
  1. Check generated image
[donia@localhost revive]$ docker images
REPOSITORY               TAG                IMAGE ID       CREATED         SIZE
ghcr.io/mgechev/revive   v1.1.2-next        47331c146281   3 minutes ago   5.55MB
  1. Run revive -version
[donia@localhost revive]$ docker run ghcr.io/mgechev/revive:v1.1.2-next -version
Current revive version v1.1.2-next commit 3514c30f3ff43b486668293c1d02d58940998c3a, built @2021-10-12T19:15:06Z by goreleaser.
  1. Run docker revive -config revive.toml ./...
[donia@localhost kidle]$ docker run -v "$(pwd)":/var/kidle ghcr.io/mgechev/revive:v1.1.2-next -config /var/kidle/revive.toml -formatter stylish ./var/kidle/...
  1. Docker inspect
[donia@localhost revive]$ docker inspect ghcr.io/mgechev/revive:v1.1.2-next 

Interesting part of the result:

            "Labels": {
                "org.opencontainers.image.description": "revive",
                "org.opencontainers.image.licenses": "MIT",
                "org.opencontainers.image.revision": "b7bc9be92422673e6b2b2430c31fcf3e9c518894",
                "org.opencontainers.image.source": "https://github.com/mgechev/revive",
                "org.opencontainers.image.title": "revive",
                "org.opencontainers.image.url": "https://github.com/mgechev/revive",
                "org.opencontainers.image.version": "v1.1.2-next"
            }

Questions

  1. Are you happy with the flags labels ?
  2. Are you happy with the documentation section place ?

Closes #489

@doniacld
Copy link
Contributor Author

doniacld commented Oct 13, 2021

After testing an analyse with the docker image, the docker cannot access the configuration file easily.

[donia@localhost kidle]$ docker run ghcr.io/mgechev/revive:v1.1.2-next -config default.toml ./...
cannot read the config file

I will investigate this before merging.

@doniacld doniacld force-pushed the fix-489-add-docker-release branch from 3514c30 to 86be174 Compare October 14, 2021 19:32
@doniacld doniacld force-pushed the fix-489-add-docker-release branch from 86be174 to 92a94a6 Compare October 14, 2021 19:35
@doniacld
Copy link
Contributor Author

doniacld commented Oct 14, 2021

After testing an analyse with the docker image, the docker cannot access the configuration file easily.

[donia@localhost kidle]$ docker run ghcr.io/mgechev/revive:v1.1.2-next -config default.toml ./...
cannot read the config file

I will investigate this before merging.

It was working but no volume was mounted between the container the host.
The right command is:

docker run -v "$(pwd)":/var/kidle ghcr.io/mgechev/revive:v1.1.2-next -config /var/kidle/revive.toml -formatter stylish ./var/kidle/...

@chavacava chavacava merged commit c0f2d40 into mgechev:master Oct 15, 2021
@chavacava
Copy link
Collaborator

Thanks for the PR @doniacld !

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.

Revive docker image
2 participants