preciazo/.github/workflows/container.yml

161 lines
5.1 KiB
YAML
Raw Normal View History

2024-01-04 22:48:26 +00:00
name: check and publish container image
2024-01-04 18:20:56 +00:00
on:
push:
branches: ["master"]
env:
REGISTRY: ghcr.io
2024-01-04 18:24:56 +00:00
IMAGE_NAME: ${{ github.repository }}
2024-01-04 18:20:56 +00:00
jobs:
2024-01-04 22:48:26 +00:00
check:
2024-01-14 13:12:59 +00:00
name: chequear typescript del sitio
2024-06-18 00:55:45 +00:00
runs-on: ubicloud-standard-4
2024-01-04 22:48:26 +00:00
steps:
2024-01-25 00:20:34 +00:00
- uses: actions/checkout@v4
2024-02-08 15:02:47 +00:00
- uses: pnpm/action-setup@v3
2024-01-14 01:09:24 +00:00
with:
version: 8
- name: Use Node.js 20
2024-01-25 00:20:34 +00:00
uses: actions/setup-node@v4
2024-01-14 01:09:24 +00:00
with:
node-version: 20
2024-01-25 00:20:34 +00:00
cache: "pnpm"
2024-01-14 01:09:24 +00:00
- name: Install dependencies
run: pnpm install
2024-01-04 22:48:26 +00:00
2024-01-14 01:09:24 +00:00
- run: pnpm check
2024-01-04 22:48:26 +00:00
working-directory: ./sitio
2024-01-04 18:24:56 +00:00
build-and-push-sitio:
name: Compilar contenedor del sitio
needs: check
2024-06-18 00:49:40 +00:00
runs-on: buildjet-4vcpu-ubuntu-2204
2024-01-04 18:24:56 +00:00
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
2024-01-04 18:24:56 +00:00
- name: Log in to the Container registry
uses: docker/login-action@v3
2024-01-04 18:24:56 +00:00
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
2024-01-04 18:24:56 +00:00
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/sitio
- name: Build and push Docker image
uses: docker/build-push-action@v5
2024-01-04 18:24:56 +00:00
with:
context: .
file: Dockerfile
2024-01-04 18:24:56 +00:00
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
2024-06-18 00:50:02 +00:00
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
cache-to: type=inline
2024-06-18 00:51:56 +00:00
platforms: linux/amd64
2024-01-11 03:41:50 +00:00
2024-06-18 00:46:22 +00:00
build-and-push-scraper-amd64:
name: "[amd64] oci:scraper"
2024-06-18 00:55:45 +00:00
runs-on: ubicloud-standard-16
2024-01-11 03:41:50 +00:00
permissions:
contents: read
packages: write
steps:
2024-01-12 12:02:59 +00:00
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
2024-01-11 03:41:50 +00:00
- name: Log in to the Container registry
2024-01-12 12:02:59 +00:00
uses: docker/login-action@v3
2024-01-11 03:41:50 +00:00
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
2024-01-12 12:02:59 +00:00
uses: docker/metadata-action@v5
2024-01-11 03:41:50 +00:00
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/scraper
- name: Build and push Docker image
2024-01-12 12:02:59 +00:00
uses: docker/build-push-action@v5
2024-01-11 03:41:50 +00:00
with:
2024-06-30 00:04:59 +00:00
context: "{{defaultContext}}:rust/"
file: scraper.Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
cache-to: type=inline
platforms: linux/amd64
build-and-push-api-amd64:
name: "[amd64] oci:api"
runs-on: ubicloud-standard-16
permissions:
contents: read
packages: write
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/api
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: "{{defaultContext}}:rust/"
file: api.Dockerfile
2024-01-11 03:41:50 +00:00
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
2024-06-18 00:44:03 +00:00
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
cache-to: type=inline
2024-06-18 00:46:22 +00:00
platforms: linux/amd64
2024-06-18 01:58:57 +00:00
# build-and-push-scraper-arm64:
# name: "[arm64] oci:scraper"
# runs-on: ubicloud-standard-16-arm
# permissions:
# contents: read
# packages: write
# steps:
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v3
# - name: Log in to the Container registry
# uses: docker/login-action@v3
# with:
# registry: ${{ env.REGISTRY }}
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
# - name: Extract metadata (tags, labels) for Docker
# id: meta
# uses: docker/metadata-action@v5
# with:
# images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/scraper
# - name: Build and push Docker image
# uses: docker/build-push-action@v5
# with:
# context: "{{defaultContext}}:scraper-rs/"
# file: Dockerfile
# push: true
# tags: ${{ steps.meta.outputs.tags }}
# labels: ${{ steps.meta.outputs.labels }}
# cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
# cache-to: type=inline
# platforms: linux/arm64