Skip to content

Commit

Permalink
Add arm64 support for alpine ext images (#118)
Browse files Browse the repository at this point in the history
Fix issue #117
  • Loading branch information
floryn90 authored Jun 22, 2024
2 parents 60de3eb + da622ce commit e6a484c
Show file tree
Hide file tree
Showing 12 changed files with 48 additions and 23 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ test: test-docsy test-docuapi

test-docsy:
@rm -rf target/test/docsy
@git clone -b v0.8.0 https://github.com/google/docsy.git target/test/docsy
@git clone -b v0.10.0 https://github.com/google/docsy.git target/test/docsy
@docker run --rm -i -v $$(pwd)/target/test/docsy:/src -u $$(id -u) --entrypoint npm floryn90/hugo:ext-alpine install
@docker run --rm -i -v $$(pwd)/target/test/docsy:/src -u $$(id -u) floryn90/hugo:ext-alpine

Expand All @@ -46,7 +46,7 @@ bump:
@RELEASE=$(version) bump

src/bin/buildx:
@wget -q -O src/bin/buildx https://github.com/docker/buildx/releases/download/v0.14.0/buildx-v0.14.0.linux-amd64
@wget -q -O src/bin/buildx https://github.com/docker/buildx/releases/download/v0.15.1/buildx-v0.15.1.linux-amd64
@chmod a+x src/bin/buildx
@docker buildx create --use

Expand Down
11 changes: 10 additions & 1 deletion src/config/alpine-ext.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ images:
- postcss
platforms:
- linux/amd64
- linux/arm64

# Alpine + Hugo extended + CI
ext-alpine-ci:
Expand All @@ -23,6 +24,7 @@ images:
- $(VERSION)-ext-alpine-ci
platforms:
- linux/amd64
- linux/arm64

# Alpine + Hugo extended + Onbuild
ext-alpine-onbuild:
Expand All @@ -31,6 +33,7 @@ images:
- $(VERSION)-ext-alpine-onbuild
platforms:
- linux/amd64
- linux/arm64

# Alpine + Hugo extended + Asciidoctor
ext-asciidoctor:
Expand All @@ -46,6 +49,7 @@ images:
- postcss
platforms:
- linux/amd64
- linux/arm64

# Alpine + Hugo extended + Asciidoctor + CI
ext-asciidoctor-ci:
Expand All @@ -54,6 +58,7 @@ images:
- $(VERSION)-ext-asciidoctor-ci
platforms:
- linux/amd64
- linux/arm64

# Alpine + Hugo extended + Asciidoctor + Onbuild
ext-asciidoctor-onbuild:
Expand All @@ -62,6 +67,7 @@ images:
- $(VERSION)-ext-asciidoctor-onbuild
platforms:
- linux/amd64
- linux/arm64

# Alpine + Hugo extended + Pandoc
ext-pandoc:
Expand All @@ -78,6 +84,7 @@ images:
- rst2html
platforms:
- linux/amd64
- linux/arm64

# Alpine + Hugo extended + Pandoc + CI
ext-pandoc-ci:
Expand All @@ -86,6 +93,7 @@ images:
- $(VERSION)-ext-pandoc-ci
platforms:
- linux/amd64
- linux/arm64

# Alpine + Hugo extended + Pandoc + Onbuild
ext-pandoc-onbuild:
Expand All @@ -94,6 +102,7 @@ images:
- $(VERSION)-ext-pandoc-onbuild
platforms:
- linux/amd64
- linux/arm64

tests:
hugo:
Expand Down Expand Up @@ -129,4 +138,4 @@ tests:

rst2html:
entrypoint: rst2html
command: --version
command: --version
2 changes: 1 addition & 1 deletion src/config/alpine.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,4 @@ tests:
pandoc:
entrypoint: pandoc
command: --version
expected: pandoc-default
expected: pandoc-default
2 changes: 1 addition & 1 deletion src/docker/_base/image.df
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ FROM busybox:latest AS busybox

FROM debian:stable-slim AS debian

FROM ubuntu:rolling AS ubuntu
FROM ubuntu:latest AS ubuntu
38 changes: 27 additions & 11 deletions src/docker/_base/nodejs.df
Original file line number Diff line number Diff line change
@@ -1,29 +1,45 @@
FROM base--image--alpine AS fetcher-glibc
# FROM base--image--alpine AS fetcher-glibc

ARG TARGETPLATFORM
# ARG TARGETPLATFORM

ADD _script/nodejs-glibc.sh nodejs.sh
RUN sh nodejs.sh
# ADD _script/nodejs-glibc.sh nodejs.sh
# RUN sh nodejs.sh



FROM scratch AS glibc
# FROM scratch AS glibc

COPY --from=fetcher-glibc /files /
# COPY --from=fetcher-glibc /files /





FROM base--image--alpine AS fetcher-musl
# FROM base--image--alpine AS fetcher-musl

ARG TARGETPLATFORM
# ARG TARGETPLATFORM

ADD _script/nodejs-musl.sh nodejs.sh
RUN sh nodejs.sh
# ADD _script/nodejs-musl.sh nodejs.sh
# RUN sh nodejs.sh



# # FROM scratch AS musl

# # COPY --from=fetcher-musl /files /



# Use the official Node.js Alpine image as the first stage
FROM node:current-alpine AS node-base

# Initialize the second stage with your custom image
FROM scratch AS musl

COPY --from=fetcher-musl /files /
# Copy Node.js, npm, and yarn related files and directories from the first stage to the second stage
COPY --from=node-base /usr/lib /usr/lib
COPY --from=node-base /usr/local/share /usr/local/share
COPY --from=node-base /usr/local/lib /usr/local/lib
COPY --from=node-base /usr/local/include /usr/local/include
COPY --from=node-base /usr/local/bin /usr/local/bin
COPY --from=node-base /opt /opt
2 changes: 1 addition & 1 deletion src/docker/alpine-ext/ext-alpine.df
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ COPY --from=image / /
RUN true \
#
# Install npm packages
&& npm install -g autoprefixer postcss postcss-cli yarn @babel/cli @babel/core @fullhuman/postcss-purgecss \
&& npm install -g autoprefixer postcss postcss-cli @babel/cli @babel/core @fullhuman/postcss-purgecss \
#
# Install rst2html
&& pip install --break-system-packages rst2html \
Expand Down
2 changes: 1 addition & 1 deletion src/docker/debian-ext/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ RUN true \
&& apt install -y ca-certificates curl gnupg \
&& mkdir -p /etc/apt/keyrings \
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_21.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \
&& apt update \
&& apt install nodejs -y \
#
Expand Down
2 changes: 1 addition & 1 deletion src/docker/ubuntu-ext/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ RUN true \
&& apt install -y ca-certificates curl gnupg \
&& mkdir -p /etc/apt/keyrings \
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_21.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \
&& apt update \
&& apt install nodejs -y \
#
Expand Down
2 changes: 1 addition & 1 deletion src/files/_script/golang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -e
set -u

# Variables
GOLANG_VERSION="1.22.2"
GOLANG_VERSION="1.22.4"

# Architecture
TARGETPLATFORM=${TARGETPLATFORM:-linux/amd64}
Expand Down
2 changes: 1 addition & 1 deletion src/files/_script/nodejs-glibc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -e
set -u

# Variables
NODE_VERSION="21.7.3"
NODE_VERSION="22.3.0"

# Architecture
TARGETPLATFORM=${TARGETPLATFORM:-linux/amd64}
Expand Down
2 changes: 1 addition & 1 deletion src/files/_script/nodejs-musl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -e
set -u

# Variables
NODE_VERSION="21.7.3"
NODE_VERSION="22.3.0"

# Architecture
TARGETPLATFORM=${TARGETPLATFORM:-linux/amd64}
Expand Down
2 changes: 1 addition & 1 deletion src/files/_script/pandoc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -e
set -u

# Variables
PANDOC_VERSION="3.1.13"
PANDOC_VERSION="3.2"

# Architecture
TARGETPLATFORM=${TARGETPLATFORM:-linux/amd64}
Expand Down

0 comments on commit e6a484c

Please sign in to comment.