Merge branch 'main' into IPCEICIS-2303_build_system
Some checks failed
ci / build (push) Has been cancelled

This commit is contained in:
Richard Robert Reitz 2025-03-15 13:12:59 +01:00
commit c56dc288b6
2 changed files with 46 additions and 24 deletions

View file

@ -1,37 +1,51 @@
name: Create and publish a Docker image
name: ci
on: push
jobs:
docker:
runs-on: docker
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
build:
runs-on: ubuntu-22.04
- name: Repository meta
steps:
-
name: Repository meta
id: repository
run: |
registry=${{ github.server_url }}
registry=${registry##http*://}
echo "registry=${registry}" >> "$GITHUB_OUTPUT"
echo "registry=${registry}"
repository="$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')"
echo "repository=${repository}" >> "$GITHUB_OUTPUT"
- name: Docker meta
echo "repository=${repository}"
-
name: Docker meta
uses: docker/metadata-action@v5
id: docker
with:
images: ${{ steps.repository.outputs.registry }}/${{ steps.repository.outputs.repository }}
- name: Build and push
uses: https://codeberg.org/umglurf/kaniko-action@main
-
name: Login to registry
uses: docker/login-action@v3
with:
registry: ${{ steps.repository.outputs.registry }}
username: ${{ secrets.PACKAGES_USER }}
password: ${{ secrets.PACKAGES_TOKEN }}
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
buildkitd-flags: '--allow-insecure-entitlement network.host'
driver-opts: network=host
-
name: Build and push
uses: docker/build-push-action@v6
with:
credentials: |
${{ steps.repository.outputs.registry }}=${{ github.repository }}:${{ secrets.PACKAGES_TOKEN }}
destinations: |
${{ steps.docker.outputs.tags }}
push: true
allow: network.host
network: host
platforms: linux/amd64,linux/arm64
tags: ${{ steps.docker.outputs.tags }}

View file

@ -14,9 +14,9 @@ RUN find packages \! -name "package.json" -mindepth 2 -maxdepth 2 -exec rm -rf {
# Stage 2 - Install dependencies and build packages
FROM node:20.18.1 AS build
# Required for macOS
# Required for arm64
RUN apt update -y
RUN apt install -y python3 make gcc build-essential
RUN apt install -y python3 make gcc build-essential bash
USER node
WORKDIR /app
@ -24,7 +24,7 @@ WORKDIR /app
COPY --from=packages --chown=node:node /app .
RUN --mount=type=cache,target=/home/node/.cache/yarn,sharing=locked,uid=1000,gid=1000 \
yarn install --network-timeout 600000
yarn install --frozen-lockfile --network-timeout 600000
COPY --chown=node:node . .
@ -51,7 +51,15 @@ RUN yarn config set python /usr/bin/python3
# Add kubectl for the kube apply plugin.
# Add mkdocs for the TechDocs plugin.
RUN curl -L -o /usr/local/bin/kubectl https://dl.k8s.io/release/v1.29.9/bin/linux/amd64/kubectl && chmod +x /usr/local/bin/kubectl
RUN if test "$(uname -m)" = "x86_64"; \
then \
curl -L -o /usr/local/bin/kubectl https://dl.k8s.io/release/v1.29.9/bin/linux/amd64/kubectl; \
fi
RUN if test "$(uname -m)" != "x86_64"; \
then \
curl -L -o /usr/local/bin/kubectl https://dl.k8s.io/release/v1.29.9/bin/linux/arm64/kubectl; \
fi
RUN chmod +x /usr/local/bin/kubectl
ENV VIRTUAL_ENV=/opt/venv
RUN python3 -m venv $VIRTUAL_ENV
@ -72,7 +80,7 @@ WORKDIR /app
COPY --from=build --chown=node:node /app/yarn.lock /app/package.json /app/packages/backend/dist/skeleton/ ./
RUN --mount=type=cache,target=/home/node/.cache/yarn,sharing=locked,uid=1000,gid=1000 \
yarn install --production --network-timeout 600000
yarn install --frozen-lockfile --production --network-timeout 600000
# Copy the built packages from the build stage
COPY --from=build --chown=node:node /app/packages/backend/dist/bundle/ ./