-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make Shopify images modular, add old images, bump Rust version
Signed-off-by: Marco Köpcke <marco.koepcke@tudock.de>
- Loading branch information
1 parent
eb8d90c
commit c048156
Showing
39 changed files
with
2,792 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
shopify builder | ||
=============== | ||
|
||
Build script to update the individual images. | ||
|
||
Creates the Dockerfile's in the other directories. | ||
|
||
Needs requirements: | ||
|
||
``` | ||
pip3 install jinja2 | ||
``` |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/usr/bin/env python | ||
import os.path | ||
import shutil | ||
|
||
from jinja2 import Environment, FileSystemLoader | ||
|
||
NODE_VERSIONS = { | ||
# Checksum | ||
"18.19.0": "10b7b23b6b867a25f060a433b83f5c3ecb3bcf7cdba1c0ce46443065a832fd41", | ||
"20.11.0": "a8bec39586538896715be7a2ca7ef08727a58ad94d25876c5db11cafacff4c37", | ||
} | ||
PHP_VERSIONS = ["8.1", "8.2", "8.3"] | ||
ALPINE_VERSION = "3.20" # Rust 1.78 | ||
COPY_FILES = [ | ||
"base.makefile", | ||
"entrypoint.sh", | ||
"Makefile", | ||
"shopify-app.md" | ||
] | ||
BASE_DIR = os.path.join(os.path.dirname(__file__), "..") | ||
BUILDER_DIR = os.path.join(BASE_DIR, "builder") | ||
|
||
if __name__ == "__main__": | ||
env = Environment( | ||
loader=FileSystemLoader(os.path.join(BUILDER_DIR, "jinja_tpl")), | ||
) | ||
template = env.get_template("Dockerfile.jinja2") | ||
|
||
for node_version, node_checksum in NODE_VERSIONS.items(): | ||
for php_version in PHP_VERSIONS: | ||
outdir = os.path.join(BASE_DIR, f"n{node_version}", f"p{php_version}") | ||
shutil.rmtree(outdir, ignore_errors=True) | ||
os.makedirs(outdir) | ||
for file in COPY_FILES: | ||
shutil.copy( | ||
os.path.join(BUILDER_DIR, file), | ||
os.path.join(outdir, file), | ||
) | ||
|
||
with open(os.path.join(outdir, "Dockerfile"), "w") as f: | ||
f.write(template.render( | ||
alpine_version=ALPINE_VERSION, | ||
node_version=node_version, | ||
php_version=php_version, | ||
node_checksum=node_checksum | ||
)) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,168 @@ | ||
FROM php:{{ php_version }}-cli-alpine{{ alpine_version }} | ||
|
||
ARG XDEBUG_CLIENT_HOST=host.docker.internal | ||
ENV XDEBUG_CLIENT_HOST $XDEBUG_CLIENT_HOST | ||
|
||
ARG DOCKER_USER=docker | ||
|
||
# add run dependencies | ||
RUN apk add --no-cache \ | ||
openrc \ | ||
bash \ | ||
postgresql-libs \ | ||
ruby ruby-dev ruby-ffi libzip-dev \ | ||
alpine-sdk \ | ||
gcompat \ | ||
icu \ | ||
linux-headers \ | ||
freetype libjpeg-turbo libpng libwebp | ||
|
||
# add build dependencies | ||
RUN apk add --no-cache -t .build-deps \ | ||
postgresql-dev \ | ||
libxml2-dev \ | ||
icu-dev \ | ||
freetype-dev libpng-dev libjpeg-turbo-dev libwebp-dev \ | ||
autoconf g++ make && \ | ||
# install bundler for extension deployment | ||
gem install bundler && \ | ||
# configure xdebug | ||
pecl install xdebug-3.3.1 && docker-php-ext-enable xdebug && \ | ||
echo 'xdebug.mode=off' >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && \ | ||
echo "xdebug.client_host=${XDEBUG_CLIENT_HOST}" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && \ | ||
echo 'xdebug.cli_color=1' >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && \ | ||
echo 'xdebug.start_with_request=yes' >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && \ | ||
# further php configuration and permissions | ||
docker-php-ext-configure pdo_mysql && docker-php-ext-install pdo_mysql && \ | ||
docker-php-ext-configure simplexml && docker-php-ext-install simplexml && \ | ||
docker-php-ext-configure pgsql && docker-php-ext-install pdo_pgsql && \ | ||
docker-php-ext-configure zip && docker-php-ext-install zip && \ | ||
docker-php-ext-configure intl && docker-php-ext-install intl && \ | ||
docker-php-ext-configure gd --with-jpeg --with-webp --with-freetype && docker-php-ext-install gd && \ | ||
chgrp 1000 /usr/local/etc/php/conf.d/ -R && \ | ||
chmod g+w /usr/local/etc/php/conf.d/ -R && \ | ||
# remove build dependencies | ||
apk del --purge .build-deps | ||
|
||
# install composer | ||
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer | ||
|
||
# use the default production configuration for PHP | ||
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" | ||
|
||
# Node and YARN installation steps taken from https://github.com/nodejs/docker-node/blob/ab5769dc69feb4007d9aafb03316ea0e3edb4227/18/alpine3.19/Dockerfile | ||
|
||
ENV NODE_VERSION {{ node_version }} | ||
|
||
RUN addgroup -g 1000 ${DOCKER_USER} \ | ||
&& adduser -u 1000 -G ${DOCKER_USER} -s /bin/sh -D ${DOCKER_USER} \ | ||
&& apk add --no-cache \ | ||
libstdc++ \ | ||
&& apk add --no-cache --virtual .build-deps \ | ||
curl \ | ||
&& ARCH= OPENSSL_ARCH='linux*' && alpineArch="$(apk --print-arch)" \ | ||
&& case "${alpineArch##*-}" in \ | ||
x86_64) ARCH='x64' CHECKSUM="{{ node_checksum }}" OPENSSL_ARCH=linux-x86_64;; \ | ||
x86) OPENSSL_ARCH=linux-elf;; \ | ||
aarch64) OPENSSL_ARCH=linux-aarch64;; \ | ||
arm*) OPENSSL_ARCH=linux-armv4;; \ | ||
ppc64le) OPENSSL_ARCH=linux-ppc64le;; \ | ||
s390x) OPENSSL_ARCH=linux-s390x;; \ | ||
*) ;; \ | ||
esac \ | ||
&& if [ -n "${CHECKSUM}" ]; then \ | ||
set -eu; \ | ||
curl -fsSLO --compressed "https://unofficial-builds.nodejs.org/download/release/v$NODE_VERSION/node-v$NODE_VERSION-linux-$ARCH-musl.tar.xz"; \ | ||
echo "$CHECKSUM node-v$NODE_VERSION-linux-$ARCH-musl.tar.xz" | sha256sum -c - \ | ||
&& tar -xJf "node-v$NODE_VERSION-linux-$ARCH-musl.tar.xz" -C /usr/local --strip-components=1 --no-same-owner \ | ||
&& ln -s /usr/local/bin/node /usr/local/bin/nodejs; \ | ||
else \ | ||
echo "Building from source" \ | ||
# backup build | ||
&& apk add --no-cache --virtual .build-deps-full \ | ||
binutils-gold \ | ||
g++ \ | ||
gcc \ | ||
gnupg \ | ||
libgcc \ | ||
linux-headers \ | ||
make \ | ||
python3 \ | ||
# use pre-existing gpg directory, see https://github.com/nodejs/docker-node/pull/1895#issuecomment-1550389150 | ||
&& export GNUPGHOME="$(mktemp -d)" \ | ||
# gpg keys listed at https://github.com/nodejs/node#release-keys | ||
&& for key in \ | ||
4ED778F539E3634C779C87C6D7062848A1AB005C \ | ||
141F07595B7B3FFE74309A937405533BE57C7D57 \ | ||
74F12602B6F1C4E913FAA37AD3A89613643B6201 \ | ||
DD792F5973C6DE52C432CBDAC77ABFA00DDBF2B7 \ | ||
61FC681DFB92A079F1685E77973F295594EC4689 \ | ||
8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600 \ | ||
C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \ | ||
890C08DB8579162FEE0DF9DB8BEAB4DFCF555EF4 \ | ||
C82FA3AE1CBEDC6BE46B9360C43CEC45C17AB93C \ | ||
108F52B48DB57BB0CC439B2997B01419BD92F80A \ | ||
A363A499291CBBC940DD62E41F10027AF002F8B0 \ | ||
; do \ | ||
gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" || \ | ||
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" ; \ | ||
done \ | ||
&& curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION.tar.xz" \ | ||
&& curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \ | ||
&& gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \ | ||
&& gpgconf --kill all \ | ||
&& rm -rf "$GNUPGHOME" \ | ||
&& grep " node-v$NODE_VERSION.tar.xz\$" SHASUMS256.txt | sha256sum -c - \ | ||
&& tar -xf "node-v$NODE_VERSION.tar.xz" \ | ||
&& cd "node-v$NODE_VERSION" \ | ||
&& ./configure \ | ||
&& make -j$(getconf _NPROCESSORS_ONLN) V= \ | ||
&& make install \ | ||
&& apk del .build-deps-full \ | ||
&& cd .. \ | ||
&& rm -Rf "node-v$NODE_VERSION" \ | ||
&& rm "node-v$NODE_VERSION.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt; \ | ||
fi \ | ||
&& rm -f "node-v$NODE_VERSION-linux-$ARCH-musl.tar.xz" \ | ||
# Remove unused OpenSSL headers to save ~34MB. See this NodeJS issue: https://github.com/nodejs/node/issues/46451 | ||
&& find /usr/local/include/node/openssl/archs -mindepth 1 -maxdepth 1 ! -name "$OPENSSL_ARCH" -exec rm -rf {} \; \ | ||
&& apk del .build-deps \ | ||
# smoke tests | ||
&& node --version \ | ||
&& npm --version | ||
|
||
ENV YARN_VERSION 1.22.19 | ||
|
||
RUN apk add --no-cache --virtual .build-deps-yarn curl gnupg tar \ | ||
# use pre-existing gpg directory, see https://github.com/nodejs/docker-node/pull/1895#issuecomment-1550389150 | ||
&& export GNUPGHOME="$(mktemp -d)" \ | ||
&& for key in \ | ||
6A010C5166006599AA17F08146C2130DFD2497F5 \ | ||
; do \ | ||
gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" || \ | ||
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" ; \ | ||
done \ | ||
&& curl -fsSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz" \ | ||
&& curl -fsSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz.asc" \ | ||
&& gpg --batch --verify yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \ | ||
&& gpgconf --kill all \ | ||
&& rm -rf "$GNUPGHOME" \ | ||
&& mkdir -p /opt \ | ||
&& tar -xzf yarn-v$YARN_VERSION.tar.gz -C /opt/ \ | ||
&& ln -s /opt/yarn-v$YARN_VERSION/bin/yarn /usr/local/bin/yarn \ | ||
&& ln -s /opt/yarn-v$YARN_VERSION/bin/yarnpkg /usr/local/bin/yarnpkg \ | ||
&& rm yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \ | ||
&& apk del .build-deps-yarn \ | ||
# smoke test | ||
&& yarn --version | ||
|
||
RUN apk --no-cache add gettext git htop tree linux-headers libc-dev | ||
|
||
# Install Rust | ||
RUN apk --no-cache add rust rust-wasm cargo | ||
RUN cargo install cargo-wasi --root=/usr/local | ||
RUN chmod 777 /usr/local/bin | ||
|
||
COPY base.makefile Makefile shopify-app.md /assets/ | ||
COPY entrypoint.sh /usr/local/bin/ | ||
ENTRYPOINT ["entrypoint.sh"] |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
include base.makefile | ||
|
||
# Add additional targets here or extend(::)/override(:) some, e.g.: | ||
|
||
# New target | ||
#install-my-project: ## description for install-my-project | ||
# @echo project installation steps | ||
|
||
# Extend: Further init directories | ||
#init-directories:: | ||
# @[ -d ~/dir ] || mkdir ~/dir | ||
|
||
# Override: New Node.js installation steps | ||
#install-nodejs: | ||
# @echo install it some other way |
Oops, something went wrong.