Feature/docker kuntoon (#11)
CI Main / Load example-gitea-env.conf to pipeline env (push) Successful in 25s
CI Main / Check existing artifact (push) Successful in 22s
unit-tests Link to Bats reports
CI Main / Bats tests (push) Successful in 1m47s
acc-tests Link to Cucumber reports
CI Main / Cucumber tests (push) Successful in 1m4s
ci-docker-build-push Docker build & push 0.2.0 OK
CI Main / Build & Push Docker (push) Successful in 35s
CI Main / Report Summary (push) Successful in 4s
CI Main / Load example-gitea-env.conf to pipeline env (push) Successful in 25s
CI Main / Check existing artifact (push) Successful in 22s
unit-tests Link to Bats reports
CI Main / Bats tests (push) Successful in 1m47s
acc-tests Link to Cucumber reports
CI Main / Cucumber tests (push) Successful in 1m4s
ci-docker-build-push Docker build & push 0.2.0 OK
CI Main / Build & Push Docker (push) Successful in 35s
CI Main / Report Summary (push) Successful in 4s
Co-authored-by: moilanik <niko.moilanen@tietoevry.com> Reviewed-on: #11
This commit is contained in:
@@ -0,0 +1,112 @@
|
||||
# Docker Registry Setup
|
||||
|
||||
Pipeline rakentaa Docker-kontin ja pushee sen haluttuun registryyn.
|
||||
|
||||
---
|
||||
|
||||
## 1. Konfiguroi `gitea-env.conf`
|
||||
|
||||
```
|
||||
# DOCKER_REGISTRY on muotoa: registry.example.com/org
|
||||
#
|
||||
# host+org: registry.example.com/org
|
||||
#
|
||||
# Pipeline rakentaa kuvan: ${DOCKER_REGISTRY}/${DOCKER_IMAGE_NAME}:${VERSION}
|
||||
|
||||
DOCKER_REGISTRY=gitea.app.keskikuja.site/niko # PAKOLLINEN — tyhjä ei käy
|
||||
DOCKER_IMAGE_NAME=gitea-ci-library-test-image # PAKOLLINEN — pelkkä kuvan nimi
|
||||
DOCKER_UI_URL= # valinnainen — tarkista Giteasta kontin oma UI-osoite ja laita se tähän ilman versiota. Workflow liittää perään /VERSION
|
||||
```
|
||||
|
||||
| Kenttä | Pakollinen | Kuvaus |
|
||||
|---|---|---|
|
||||
| `DOCKER_REGISTRY` | **kyllä** | Registry + mahdollinen organisaatio. **Tyhjä pysäyttää workflow'n.** |
|
||||
| `DOCKER_IMAGE_NAME` | **kyllä** | Pelkkä kuvan nimi. |
|
||||
| `DOCKER_UI_URL` | ei | Base-URL kontin UI-sivulle (ilman versiota). Osoite riippuu onko kontti linkitetty repoon vai ei — tarkista Giteasta. Workflow liittää perään `/VERSION`. |
|
||||
|
||||
**Koko image-ref = `${DOCKER_REGISTRY}/${DOCKER_IMAGE_NAME}:${VERSION}`**
|
||||
Esim. `gitea.app.keskikuja.site/niko/gitea-ci-library-test-image:0.1.0`
|
||||
|
||||
---
|
||||
|
||||
## 2. Luo PAT (Personal Access Token) Giteassa
|
||||
|
||||
**Gitea → oma profiili (oikea yläkulma) → Settings → Applications → Manage Access Tokens → Generate New Token**
|
||||
|
||||
Valitse scope:
|
||||
|
||||
| Scope | Pääsy |
|
||||
|---|---|
|
||||
| `package` | **Read and Write** |
|
||||
|
||||
> Tämä token toimii salasanana `docker login` -komennossa. Muut scopet (kuten `repository`) eivät riitä — konttirekisteri vaatii nimenomaan `package`-scopen.
|
||||
|
||||
Tokenin arvo näytetään **vain kerran** luomisen yhteydessä. Kopioi se talteen.
|
||||
|
||||
---
|
||||
|
||||
## 3. Tallenna PAT repositoryn Secretsiin
|
||||
|
||||
Nämä ovat kaksi eri paikkaa:
|
||||
- **Access Tokenit** (User Settings) = missä luot tokenin
|
||||
- **Repository Secrets** (Repository Settings) = minne talletat sen workflow'n käyttöön
|
||||
|
||||
**Repository → Settings → Actions → Secrets → Add new secret**
|
||||
|
||||
| Secret | Arvo |
|
||||
|---|---|
|
||||
| `DOCKER_PASSWORD` | Edellisessä vaiheessa luotu PAT |
|
||||
|
||||
`DOCKER_USERNAME`-secretiä **ei tarvita**. Workflow käyttää automaattisesti `${{ github.actor }}` (workflowin käynnistäjä).
|
||||
|
||||
Jos registry vaatii eri käyttäjätunnuksen kuin `github.actor` (esim. Artifactory, Docker Hub), lisää myös:
|
||||
|
||||
| Secret | Arvo |
|
||||
|---|---|
|
||||
| `DOCKER_USERNAME` | Registryn käyttäjätunnus |
|
||||
|
||||
---
|
||||
|
||||
## 4. Tarkistuslista ennen ajoa
|
||||
|
||||
- [ ] `DOCKER_REGISTRY` asetettu `gitea-env.conf`issa
|
||||
- [ ] `DOCKER_IMAGE_NAME` asetettu `gitea-env.conf`issa
|
||||
- [ ] PAT luotu Giteassa scopella `package` Read and Write
|
||||
- [ ] `DOCKER_PASSWORD`-secret tallennettu repositoryn Secretsiin (se PAT)
|
||||
- [ ] (tarvittaessa) `DOCKER_USERNAME`-secret — oletus `github.actor`
|
||||
|
||||
---
|
||||
|
||||
## 5. Esimerkkejä eri polkurakenteista
|
||||
|
||||
### 5a. Pelkkä hosti — Artifactory
|
||||
|
||||
```
|
||||
DOCKER_REGISTRY=ngdo-docker.artifactorypro.shared.pub.tds.tieto.com
|
||||
DOCKER_IMAGE_NAME=microservice-temperature-store
|
||||
DOCKER_UI_URL=https://artifactorypro.shared.pub.tds.tieto.com/ui/repos/tree/General/ngdo-docker.artifactorypro.shared.pub.tds.tieto.com/microservice-temperature-store
|
||||
```
|
||||
|
||||
- Kontti: `ngdo-docker.../microservice-temperature-store:0.1.0`
|
||||
- Secret `DOCKER_USERNAME` = service account -tunnus
|
||||
- Secret `DOCKER_PASSWORD` = API-token
|
||||
|
||||
### 5b. Hosti + org — Gitea user-taso
|
||||
|
||||
```
|
||||
DOCKER_REGISTRY=gitea.app.keskikuja.site/niko
|
||||
DOCKER_IMAGE_NAME=gitea-ci-library-test-image
|
||||
DOCKER_UI_URL= # tarkista Giteasta kontin UI-osoite
|
||||
```
|
||||
|
||||
- Kontti: `gitea.app.keskikuja.site/niko/gitea-ci-library-test-image:0.1.0`
|
||||
- Paketti käyttäjän `niko` alla. Linkitys repoon tehdään Gitean UI:sta: paketin sivulta (Package → Settings) → linkitä repositoryyn.
|
||||
|
||||
```
|
||||
DOCKER_REGISTRY=docker.io/library
|
||||
DOCKER_IMAGE_NAME=oma-kuva
|
||||
DOCKER_UI_URL=https://hub.docker.com/r/library/oma-kuva
|
||||
```
|
||||
|
||||
- Secret `DOCKER_USERNAME` = Docker Hub -käyttäjä
|
||||
- Secret `DOCKER_PASSWORD` = Access Token (ei salasana)
|
||||
Reference in New Issue
Block a user