You've already forked wc-bootstrap
Add Docker development environment
Multistage Dockerfile (WooCommerce download, wp-bootstrap npm build, Composer deps, WordPress runtime), Compose stack with MariaDB, and auto-setup entrypoint that installs WordPress and activates the theme on first boot. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
70
docker/Dockerfile
Normal file
70
docker/Dockerfile
Normal file
@@ -0,0 +1,70 @@
|
||||
###############################################################################
|
||||
# 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"]
|
||||
Reference in New Issue
Block a user