Skip to content

Commit

Permalink
feat: Adicionar etapas de implantação packages para produção, staging…
Browse files Browse the repository at this point in the history
… e desenvolvimento
  • Loading branch information
nataliagranato committed Sep 14, 2024
1 parent 422845d commit 01eccd1
Show file tree
Hide file tree
Showing 3 changed files with 151 additions and 1 deletion.
75 changes: 75 additions & 0 deletions .github/workflows/package-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Melange, APKO e GitHub Container Registry em Desenvolvimento

on:
push:
branches:
- 'main'

jobs:
build:
name: Melange, APKO e GitHub Container Registry
runs-on: ubuntu-20.04
permissions:
actions: read
contents: read
security-events: write

steps:
# Checkout do código
- name: Checkout code
uses: actions/checkout@v4

# Configurar Docker Buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

# Instalar Melange
- name: Install Melange
run: |
wget https://github.com/chainguard-dev/melange/releases/download/v0.11.2/melange_0.11.2_linux_386.tar.gz
tar -xzf melange_0.11.2_linux_386.tar.gz
cd melange_0.11.2_linux_386
sudo mv melange /usr/local/bin/
melange version
# Instalar APKO
- name: Install APKO
run: |
wget https://github.com/chainguard-dev/apko/releases/download/v0.14.7/apko_0.14.7_linux_386.tar.gz
tar -xzf apko_0.14.7_linux_386.tar.gz
cd apko_0.14.7_linux_386
sudo mv apko /usr/local/bin/
apko version
# Gerar chaves com Melange
- name: Generate keys with Melange
run: |
cd chainguard/environments/dev
melange keygen
# Construir pacotes com Melange
- name: Build packages with Melange
run: |
cd chainguard/environments/dev
melange build melange-prod.yaml --runner docker --signing-key melange.rsa --arch amd64
# Construir imagem de container com APKO
- name: Build container image with APKO
run: |
cd chainguard/environments/dev
apko build apko-prod.yaml senhas senhas-prod.tar -k melange.rsa.pub --arch amd64
# Log in no GitHub Container Registry
- name: Log in to GitHub Container Registry
env:
CR_PAT: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
run: echo $CR_PAT | docker login ghcr.io -u nataliagranato --password-stdin

# Load da imagem de container e push para o GitHub Container Registry
- name: Load Docker image
run: |
cd chainguard/environments/dev
docker load < senhas-prod.tar
docker images
docker tag senhas:latest-amd64 ghcr.io/nataliagranato/senhas-dev:$(date +%s)
docker push ghcr.io/nataliagranato/senhas-dev:$(date +%s)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Melange, APKO e GitHub Container Registry
name: Melange, APKO e GitHub Container Registry em Produção

on:
push:
Expand Down
75 changes: 75 additions & 0 deletions .github/workflows/package-stg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Melange, APKO e GitHub Container Registry em Staging

on:
push:
branches:
- 'main'

jobs:
build:
name: Melange, APKO e GitHub Container Registry
runs-on: ubuntu-20.04
permissions:
actions: read
contents: read
security-events: write

steps:
# Checkout do código
- name: Checkout code
uses: actions/checkout@v4

# Configurar Docker Buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

# Instalar Melange
- name: Install Melange
run: |
wget https://github.com/chainguard-dev/melange/releases/download/v0.11.2/melange_0.11.2_linux_386.tar.gz
tar -xzf melange_0.11.2_linux_386.tar.gz
cd melange_0.11.2_linux_386
sudo mv melange /usr/local/bin/
melange version
# Instalar APKO
- name: Install APKO
run: |
wget https://github.com/chainguard-dev/apko/releases/download/v0.14.7/apko_0.14.7_linux_386.tar.gz
tar -xzf apko_0.14.7_linux_386.tar.gz
cd apko_0.14.7_linux_386
sudo mv apko /usr/local/bin/
apko version
# Gerar chaves com Melange
- name: Generate keys with Melange
run: |
cd chainguard/environments/stg
melange keygen
# Construir pacotes com Melange
- name: Build packages with Melange
run: |
cd chainguard/environments/stg
melange build melange-prod.yaml --runner docker --signing-key melange.rsa --arch amd64
# Construir imagem de container com APKO
- name: Build container image with APKO
run: |
cd chainguard/environments/stg
apko build apko-prod.yaml senhas senhas-prod.tar -k melange.rsa.pub --arch amd64
# Log in no GitHub Container Registry
- name: Log in to GitHub Container Registry
env:
CR_PAT: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
run: echo $CR_PAT | docker login ghcr.io -u nataliagranato --password-stdin

# Load da imagem de container e push para o GitHub Container Registry
- name: Load Docker image
run: |
cd chainguard/environments/stg
docker load < senhas-prod.tar
docker images
docker tag senhas:latest-amd64 ghcr.io/nataliagranato/senhas-stg:$(date +%s)
docker push ghcr.io/nataliagranato/senhas-stg:$(date +%s)

0 comments on commit 01eccd1

Please sign in to comment.