feat: set up ubuntu base image build
All checks were successful
/ build-images (ubuntu-2204) (push) Successful in 2m32s
All checks were successful
/ build-images (ubuntu-2204) (push) Successful in 2m32s
This commit is contained in:
parent
9a81a5d9a7
commit
3733e43428
5 changed files with 83 additions and 0 deletions
20
.forgejo/workflows/ci.yml
Normal file
20
.forgejo/workflows/ci.yml
Normal file
|
@ -0,0 +1,20 @@
|
|||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
|
||||
env:
|
||||
REGISTRY_ENDPOINT: host.containers.internal:5000
|
||||
|
||||
jobs:
|
||||
build-images:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
image-name: ['ubuntu-2204']
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Login to Registry
|
||||
run: podman login -u ${{ secrets.REGISTRY_USER }} -p ${{ secrets.REGISTRY_TOKEN }} ${{ env.REGISTRY_ENDPOINT }}
|
||||
- name: Build image (${{ matrix.image-name }})
|
||||
run: ./script/build-image.sh ${{ matrix.image-name }}
|
33
images/ubuntu-2204/Dockerfile
Normal file
33
images/ubuntu-2204/Dockerfile
Normal file
|
@ -0,0 +1,33 @@
|
|||
FROM ubuntu:22.04 as skeleton
|
||||
|
||||
ENV NODE_VERSION="20.12.2"
|
||||
|
||||
RUN apt update && \
|
||||
apt upgrade -y && \
|
||||
apt install -y \
|
||||
curl \
|
||||
podman \
|
||||
jq \
|
||||
git \
|
||||
xz-utils \
|
||||
ca-certificates \
|
||||
unzip \
|
||||
--no-install-recommends \
|
||||
--autoremove
|
||||
|
||||
FROM skeleton as build
|
||||
|
||||
WORKDIR tmp
|
||||
|
||||
RUN curl https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.xz \
|
||||
--output /tmp/node-v$NODE_VERSION-linux-x64.tar.xz && \
|
||||
tar -xf /tmp/node-v$NODE_VERSION-linux-x64.tar.xz
|
||||
|
||||
FROM skeleton as runner
|
||||
|
||||
WORKDIR /runner
|
||||
|
||||
COPY --from=build /tmp/node-v$NODE_VERSION-linux-x64/bin/* /bin/
|
||||
COPY --from=build /tmp/node-v$NODE_VERSION-linux-x64/lib/* /lib/
|
||||
|
||||
COPY ./files/registries.conf /etc/containers/registries.conf
|
3
images/ubuntu-2204/files/registries.conf
Normal file
3
images/ubuntu-2204/files/registries.conf
Normal file
|
@ -0,0 +1,3 @@
|
|||
[[registry]]
|
||||
insecure = true
|
||||
location = "host.containers.internal:5000"
|
15
script/build-image.sh
Executable file
15
script/build-image.sh
Executable file
|
@ -0,0 +1,15 @@
|
|||
#!/bin/bash
|
||||
|
||||
image_name=$1
|
||||
|
||||
if [[ -z $image_name ]]; then
|
||||
echo "An image name must be provided."
|
||||
return
|
||||
fi
|
||||
|
||||
image_tag=$(./script/get-tag.sh)
|
||||
|
||||
(
|
||||
cd "images/$image_name"
|
||||
podman build -t "$image_name:$image_tag" -f ./Dockerfile
|
||||
)
|
12
script/get-tag.sh
Executable file
12
script/get-tag.sh
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
has_changes=$(git status --short)
|
||||
head_sha=$(git rev-parse --short HEAD)
|
||||
|
||||
tag=$head_sha
|
||||
|
||||
if [[ -n $has_changes ]]; then
|
||||
tag="$tag-dev"
|
||||
fi
|
||||
|
||||
echo "$tag"
|
Loading…
Reference in a new issue