๐ chapter ํ๊ฒฝ๋ณ์
ํ๊ฒฝ๋ณ์๋ - ๊ฐ๊ธฐ ๋ค๋ฅธ ์ปดํจํฐ, ์ฌ์ฉ์๋ง๋ค ๋ณ๋๋ก ๊ฐ์ง ์ ์๋ ๊ณ ์ ํ ์ ๋ณด๋ฅผ ๋ด๋๋ฐ ์ฌ์ฉํ๋ ๋ณ์
์ ํ์ํ๊ฐ?
- ๋ฐฐํฌ๋๋ ๊ธฐ๋ฅ๋ง๋ค ์ค์ ์ด ๋ฌ๋ผ์ง ์ ์๊ธฐ ๋๋ฌธ์
ํ๊ฒฝ ๋ณ์ ์ค์ ์
- ๋ฆฌ๋ ์ค ์ด์์ฒด์ : export ๋ช ๋ น์ด
- ์ฝ๋๋ฅผ ํตํด ์ค์ ํ๋ ๋ฒ : node.js → process.env
- ์๋น์ค ๋ด์์ ํ๊ฒฝ ๋ณ์๋ฅผ ์ค์ : github action
๐ sprint / ์ฝ๋๋ก๋ถํฐ ํ๊ฒฝ ๋ณ์ ๋ถ๋ฆฌ
1. Docker ๋น๋์ฉ GitHub Action workflow ๋ง๋ค๊ธฐ
name: Publish Docker image
on:
release:
types: [published]
jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Log in to Docker Hub
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: my-docker-hub-namespace/my-docker-hub-repository
- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
์ฐธ๊ณ ๋ ํผ๋ฐ์ค
Publishing Docker images - GitHub Docs
Introduction This guide shows you how to create a workflow that performs a Docker build, and then publishes Docker images to Docker Hub or GitHub Packages. With a single workflow, you can publish images to a single registry or to multiple registries. Prere
docs.github.com
2. Release → Create a new release
tag `v.1.0.0`
์๋ ์๋จ์ ํ์ธ
why?
Error : Username and password required
3. ์ธ์ฆ ์ ๋ณด ํ๊ฒฝ ๋ณ์ ๋ง๋ค๊ธฐ
`DOCKER_USERNAME` ๋ฐ `DOCKER_PASSWORD`๋ผ๋ ํ๊ฒฝ ๋ณ์๊ฐ ์กด์ฌ
Settings → Security → Secrets and variables → Actions
์ด๋ ๊ฒ ํ๊ฒฝ๋ณ์ ์์ฑํด์ฃผ๊ธฐ
๋ฆด๋ฆฌ์ฆ ์ฑ๊ณต
4. Docker repository ํ์ธํ๊ธฐ
https://hub.docker.com/u/<my_id>
'study > devops' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
๋ง์ดํฌ๋ก์๋น์ค ๊ฐ๋ฐ์ ์ํ Domain Driven Design, DDD (1) (0) | 2023.01.31 |
---|---|
๋ง์ดํฌ๋ก์๋น์ค ์ํคํ ์ฒ(Microservices Architecture, MSA) (0) | 2023.01.30 |
Docker (2) | 2023.01.10 |
ํ์ค์คํธ๋ฆผ..๊ทธ๋ฆฌ๊ณ (1) | 2022.12.02 |
๋ฆฌ๋ ์ค ์ด์์ฒด์ (0) | 2022.11.30 |