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

feat: Build & Push images as part of CI #44

Merged
merged 4 commits into from
May 7, 2023

Conversation

andoriyu
Copy link
Contributor

@andoriyu andoriyu commented Apr 8, 2023

Add steps to build & push image to GitHub's container registry.

Steps setup to:

  • tag image with git commit SHA if it's a regular push event
  • tag image with git's tag minus v prefix if it's a tag build (I didn't update the job to run on tag events, though)
  • tag image as latest if it's a build on main branch.

Validated on my fork.

Closes #16

@zhaofengli
Copy link
Owner

Hi, thanks for the PR! Could you make it so that it checks what permissions are allowed by the current token or make the push step optional, so the CI pipeline doesn't fail for PRs?

@andoriyu
Copy link
Contributor Author

Hi, thanks for the PR! Could you make it so that it checks what permissions are allowed by the current token or make the push step optional, so the CI pipeline doesn't fail for PRs?

I don't think there is a way to check it. Main issue in this case: head for this PR is my fork and it's trying to push image to your repository.

@zhaofengli maybe it makes more sense to no run this on PRs at all?

@zhaofengli
Copy link
Owner

Yeah, that should work fine.

@andoriyu
Copy link
Contributor Author

@zhaofengli updated to only run on push to default branch and made it optional.

@zhaofengli
Copy link
Owner

❤️ LGTM. Sorry for the delay!

@zhaofengli zhaofengli merged commit 5f85e35 into zhaofengli:main May 7, 2023
@pbek
Copy link

pbek commented May 7, 2023

I was trilled waiting for this docker image! So I was testing it now immediately. Unfortunately it doesn't seem to do anything yet.

My docker-compose.yaml:

version: '3.7'
services:
  attic:
    image: ghcr.io/zhaofengli/attic:latest

When I run the service it just quits.
This is the log:

attic-test-attic-1  | Attic Server 0.1.0 (release)
attic-test-attic-1  | Error: No such file or directory (os error 2)

@pbek
Copy link

pbek commented May 7, 2023

Unfortunately I have almost no experience yet in dockerizing this the "nix" way. 😅 I've only experience concocting Dockerfiles. 😁

@pbek
Copy link

pbek commented May 7, 2023

I came up with an working example:

version: '3.7'
services:
  attic:
    image: ghcr.io/zhaofengli/attic:latest
    volumes:
      - ./attic/server.toml:/attic/server.toml
      - ./attic/server.db:/attic/server.db
      - attic-storage:/attic/storage
    command: [ "-f", "/attic/server.toml" ]
    ports:
      - 8080:8080

volumes:
  attic-storage:

@pbek
Copy link

pbek commented May 7, 2023

I added #47.

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.

[Feature Requests] Official docker image
3 participants