Getting started with GitHub Container Registry - yunkon-kim/test-on-github-actions GitHub Wiki

Getting started with GitHub Container Registry

Command Line Interface (CLI)์™€ GitHub Actions์—์„œ GitHub Container Registry๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์„ค๋ช…ํ•ฉ๋‹ˆ๋‹ค. ์ˆœ์ฐจ์ ์œผ๋กœ ๋”ฐ๋ผํ•  ์ˆ˜ ์žˆ๋„๋ก ๊ตฌ์„ฑํ•˜์˜€์Šต๋‹ˆ๋‹ค. GitHub Container Registry์— ๋Œ€ํ•œ ์„ค๋ช…์€ ๋‹ค์Œ ๊ธ€์„ ์ฐธ๊ณ ํ•˜์„ธ์š”. ๐Ÿ˜„

โ–ถ๏ธ About GitHub Container Registry

Prerequisites

Personal access token (PAT)

โ–ถ๏ธ About GitHub secrets and personal access tokens

Steps to create a personal access token

  1. GitHub ๋กœ๊ทธ์ธ

  2. ์šฐ์ธก ์ƒ๋‹จ GitHub Profile ํด๋ฆญ(์•„๋ž˜ ๊ทธ๋ฆผ ์ฐธ๊ณ )

  1. Settings ํด๋ฆญ

  2. ์ขŒ์ธก ๋ชฉ๋ก ํ•˜๋‹จ์˜ Developer settings ํด๋ฆญ

  3. ์ขŒ์ธก ๋ชฉ๋ก ํ•˜๋‹จ์˜ Personal access tokens ํด๋ฆญ

  4. ์šฐ์ธก ์ƒ๋‹จ์˜ Generate new tokens ํด๋ฆญ

  5. Note ์ž…๋ ฅ

  6. Scope ์„ ํƒ

    1. "Select scopes"์— ์žˆ๋Š” Read more about OAuth scopes ๋งํฌ๋ฅผ ์ฐธ๊ณ ํ•˜์‹œ๊ธฐ ๋ฐ”๋ž๋‹ˆ๋‹ค.

    2. GHCR์‚ฌ์šฉ์„ ์œ„ํ•ด์„œ๋Š” ์ฃผ๋กœ write:packages,read:packages, delete:packages๋ฅผ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.

    3. repo scope์— ๋Œ€ํ•ด์„œ๋Š” ์•„๋ž˜ ๋…ธํŠธ๋ฅผ ์ฐธ๊ณ ํ•˜๊ธฐ ๋ฐ”๋ž๋‹ˆ๋‹ค.(๋ชจ๋“  Collaborators์˜ Repository ์ ‘๊ทผ ํ—ˆ์šฉ๊ณผ ๊ด€๋ จ ์žˆ์Šต๋‹ˆ๋‹ค.)

      Note: If you select the write:packages scope, deselect the repo scope when creating the PAT. Adding a PAT with the repo scope as a secret in your repository allows the credential to be accessible to all collaborators in the repository. This gives unnecessary additional access when a PAT with the repo scope is used within an action. For more information on security best practices for actions, see "Security hardening for GitHub Actions." - Authenticating to GitHub Container Registry

  7. Generate token ํด๋ฆญ

How to use GHCR

Using GHCR with Command Line Interface (CLI)

  1. GitHub Container Registry ๋กœ๊ทธ์ธ

    docker login ghcr.io -u <YOUR_GITHUB_ID>
  2. Container image ์กฐํšŒ

    docker images -a
  3. ์ด๋ฏธ์ง€ ํƒœ๊ทธ

    docker tag <YOUR_IMAGE_ID> ghcr.io/<YOUR_GITHUB_ID>/<YOUR_IMAGE_NAME>:<YOUR_TAG>
  4. ์ด๋ฏธ์ง€ ํ‘ธ์‹œ

    docker push ghcr.io/<YOUR_GITHUB_ID>/<YOUR_IMAGE_NAME>:<YOUR_TAG>
    

Using GHCR with GitHub Actions

To be updated

Where to find container images

โš ๏ธ **GitHub.com Fallback** โš ๏ธ