You've already forked wc-bootstrap
71 lines
2.7 KiB
Docker
71 lines
2.7 KiB
Docker
|
|
###############################################################################
|
||
|
|
# Stage 1 — Download WooCommerce from WordPress.org
|
||
|
|
###############################################################################
|
||
|
|
FROM alpine:3.21 AS woocommerce
|
||
|
|
|
||
|
|
RUN apk add --no-cache curl unzip jq
|
||
|
|
|
||
|
|
ARG WOOCOMMERCE_VERSION=latest
|
||
|
|
RUN set -ex; \
|
||
|
|
if [ "$WOOCOMMERCE_VERSION" = "latest" ]; then \
|
||
|
|
URL=$(curl -sSf "https://api.wordpress.org/plugins/info/1.2/?action=plugin_information&slug=woocommerce" \
|
||
|
|
| jq -r '.download_link'); \
|
||
|
|
else \
|
||
|
|
URL="https://downloads.wordpress.org/plugin/woocommerce.${WOOCOMMERCE_VERSION}.zip"; \
|
||
|
|
fi; \
|
||
|
|
curl -sSfL -o /tmp/woocommerce.zip "$URL"; \
|
||
|
|
unzip -q /tmp/woocommerce.zip -d /tmp/plugins; \
|
||
|
|
rm /tmp/woocommerce.zip
|
||
|
|
|
||
|
|
|
||
|
|
###############################################################################
|
||
|
|
# Stage 2 — Build wp-bootstrap theme assets
|
||
|
|
###############################################################################
|
||
|
|
FROM node:20-alpine AS wp-bootstrap-assets
|
||
|
|
|
||
|
|
COPY --from=wp-bootstrap . /build
|
||
|
|
WORKDIR /build
|
||
|
|
RUN npm ci && npm run build \
|
||
|
|
&& rm -rf node_modules src .git .gitea .github .vscode .claude .idea \
|
||
|
|
CLAUDE.md PLAN.md package.json package-lock.json .editorconfig \
|
||
|
|
releases .gitignore
|
||
|
|
|
||
|
|
|
||
|
|
###############################################################################
|
||
|
|
# Stage 3 — Install Composer dependencies for both themes
|
||
|
|
###############################################################################
|
||
|
|
FROM composer:2 AS composer
|
||
|
|
|
||
|
|
COPY --from=wp-bootstrap-assets /build /themes/wp-bootstrap
|
||
|
|
WORKDIR /themes/wp-bootstrap
|
||
|
|
RUN composer install --no-dev --optimize-autoloader --no-interaction
|
||
|
|
|
||
|
|
COPY . /themes/wc-bootstrap
|
||
|
|
WORKDIR /themes/wc-bootstrap
|
||
|
|
RUN composer install --no-dev --optimize-autoloader --no-interaction
|
||
|
|
|
||
|
|
|
||
|
|
###############################################################################
|
||
|
|
# Stage 4 — Final WordPress image
|
||
|
|
###############################################################################
|
||
|
|
FROM wordpress:6.9.1-php8.4-apache AS wp_runtime
|
||
|
|
|
||
|
|
RUN curl -sSfL -o /usr/local/bin/wp \
|
||
|
|
https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar \
|
||
|
|
&& chmod +x /usr/local/bin/wp
|
||
|
|
|
||
|
|
COPY --from=woocommerce /tmp/plugins/woocommerce \
|
||
|
|
/var/www/html/wp-content/plugins/woocommerce
|
||
|
|
|
||
|
|
COPY --from=composer /themes/wp-bootstrap \
|
||
|
|
/var/www/html/wp-content/themes/wp-bootstrap
|
||
|
|
|
||
|
|
COPY --from=composer /themes/wc-bootstrap \
|
||
|
|
/var/www/html/wp-content/themes/wc-bootstrap
|
||
|
|
|
||
|
|
COPY --link --chmod=0755 docker/setup.sh /usr/local/bin/setup.sh
|
||
|
|
COPY --link --chmod=0755 docker/entrypoint.sh /usr/local/bin/wc-entrypoint.sh
|
||
|
|
|
||
|
|
ENTRYPOINT ["wc-entrypoint.sh"]
|
||
|
|
CMD ["apache2-foreground"]
|