Skip to content

Commit

Permalink
feat!: drop distro from files
Browse files Browse the repository at this point in the history
  • Loading branch information
viceice committed Oct 11, 2023
1 parent 02954b5 commit e42396e
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 67 deletions.
9 changes: 0 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,11 @@ jobs:
strategy:
fail-fast: false
matrix:
distro:
- focal
- jammy
arch:
- x86_64
- aarch64

env:
DISTRO: ${{ matrix.distro }} # build target, name required by binary-builder
ARCH: ${{ matrix.arch }} # build target, name required by binary-builder

steps:
Expand All @@ -45,8 +41,3 @@ jobs:
command: binary-builder
dry-run: ${{github.ref_name != 'main'}}
token: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: ${{ env.DISTRO }}
path: .cache/*.tar.xz
22 changes: 1 addition & 21 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,4 @@
#--------------------------------------
# Ubuntu flavor
#--------------------------------------
ARG DISTRO=focal

#--------------------------------------
# base images
#--------------------------------------
FROM ubuntu:focal@sha256:33a5cc25d22c45900796a1aca487ad7a7cb09f09ea00b779e3b2026b4fc2faba as build-focal
FROM ubuntu:jammy@sha256:9b8dec3bf938bc80fbe758d856e96fdfab5f56c39d44b0cff351e847bb1b01ea as build-jammy

FROM ghcr.io/containerbase/base:9.20.12@sha256:c2a0548b8f6a7fa82ca08586b7298fe05b8be5badcd94096cb2d4f88961c40e5 as containerbase


#--------------------------------------
# builder images
#--------------------------------------
FROM build-${DISTRO} as builder

COPY --from=containerbase /usr/local/bin/ /usr/local/bin/
COPY --from=containerbase /usr/local/containerbase /usr/local/containerbase
FROM ghcr.io/containerbase/base:9.20.12@sha256:c2a0548b8f6a7fa82ca08586b7298fe05b8be5badcd94096cb2d4f88961c40e5

ENTRYPOINT [ "dumb-init", "--", "builder.sh" ]

Expand Down
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Prebuild NodeJS releases used by [containerbase/base](https://github.com/contain
Build the image

```bash
docker build -t builder --build-arg APT_PROXY=http://apt-proxy:3142 --build-arg DISTRO=focal .
docker build -t builder .
```

Test the image
Expand All @@ -24,8 +24,6 @@ docker run --rm -it -v ${PWD}/.cache:/cache -e DEBURG=true builder 18.0.0

Optional environment variables

| Name | Description | Default |
| ----------- | ------------------------------------------------------------ | --------- |
| `DISTRO` | Set an ubuntu base distro, `focal` and `jammy` are supported | `focal` |
| `APT_PROXY` | Set an APT http proxy for installing build deps | `<empty>` |
| `DEBUG` | Show verbose php build output | `<empty>` |
| Name | Description | Default |
| ------- | ----------------------------- | --------- |
| `DEBUG` | Show verbose php build output | `<empty>` |
9 changes: 3 additions & 6 deletions bin/builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ set -e
# trim leading v
TOOL_VERSION=${1#v}

# shellcheck disable=SC1091
CODENAME=$(. /etc/os-release && echo "${VERSION_CODENAME}")

NAME=node
ARCH=$(uname -p)
farch=x64
Expand All @@ -37,7 +34,7 @@ function check_semver () {

check_semver "${TOOL_VERSION}"

echo "Building ${NAME} ${TOOL_VERSION} for ${CODENAME}"
echo "Building ${NAME} ${TOOL_VERSION} for ${ARCH}"
checksum_file=$(get_from_url "https://nodejs.org/dist/v${TOOL_VERSION}/SHASUMS256.txt")
expected_checksum=$(grep "node-v${TOOL_VERSION}-linux-${farch}.tar.xz" "${checksum_file}" | cut -d' ' -f1)
file=$(get_from_url \
Expand All @@ -56,5 +53,5 @@ tar -C "/usr/local/${NAME}/${TOOL_VERSION}" --strip 1 -xf "${file}"

"/usr/local/${NAME}/${TOOL_VERSION}/bin/node" -v

echo "Compressing ${NAME} ${TOOL_VERSION} for ${CODENAME}-${ARCH}"
cp -f "${file}" "/cache/${NAME}-${TOOL_VERSION}-${CODENAME}-${ARCH}.tar.xz"
echo "Compressing ${NAME} ${TOOL_VERSION} for ${ARCH}"
cp -f "${file}" "/cache/${NAME}-${TOOL_VERSION}-${ARCH}.tar.xz"
25 changes: 0 additions & 25 deletions bin/install-builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,5 @@

set -e


echo "APT::Install-Recommends \"false\";" | tee -a /etc/apt/apt.conf.d/99containerbase.conf
echo "APT::Get::Upgrade \"false\";" | tee -a /etc/apt/apt.conf.d/99containerbase.conf
echo "APT::Get::Install-Suggests \"false\";" | tee -a /etc/apt/apt.conf.d/99containerbase.conf

if [[ -n "${APT_PROXY}" ]]; then
echo "Acquire::http::proxy \"${APT_PROXY}\";" | tee -a /etc/apt/apt.conf.d/99containerbase-proxy.conf
fi

export DEBIAN_FRONTEND=noninteractive

apt-get update -q
apt-get install -q -y \
ca-certificates \
curl \
dumb-init \
xz-utils \
;

mkdir -p /usr/local/node /cache

#--------------------------------
# cleanup
#--------------------------------
if [[ -n "${APT_PROXY}" ]]; then
rm -f /etc/apt/apt.conf.d/99containerbase-proxy.conf
fi

0 comments on commit e42396e

Please sign in to comment.