Skip to content

Commit

Permalink
Merge branch 'release/4.0.4' into v4
Browse files Browse the repository at this point in the history
  • Loading branch information
khalwat committed Feb 10, 2023
2 parents 72fa38a + ec91020 commit a424c21
Show file tree
Hide file tree
Showing 79 changed files with 8,205 additions and 9,432 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# ImageOptimize Changelog

## 4.0.4 - 2023.02.09
### Changed
* Use dynamic docker container name & port for the `buildchain`
* Update the `buildchain` to use Vite `^4.0.0`
* Updated docs to use VitePress `^1.0.0-alpha.29`
* Refactored the docs buildchain to use a dynamic docker container setup

## 4.0.3 - 2022.11.17
### Changed
* Fixed HMR in local dev with explicit alias that resolves to the actual directory
Expand Down
28 changes: 28 additions & 0 deletions buildchain/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

# Misc directories & files
coverage/*
.stylelintcache
6 changes: 3 additions & 3 deletions buildchain/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ARG TAG=16-alpine
FROM nystudio107/node-dev-base:$TAG
ARG TAG=18-alpine
FROM node:$TAG

USER node
RUN npm install -g npm@^9.3.0

WORKDIR /app/buildchain/

Expand Down
63 changes: 29 additions & 34 deletions buildchain/Makefile
Original file line number Diff line number Diff line change
@@ -1,43 +1,38 @@
TAG?=16-alpine
CONTAINER?=$(shell basename $(dir $(CURDIR)))-buildchain
DOCKERRUN=docker container run \
--name ${CONTAINER} \
--rm \
-t \
--network plugindev_default \
-p 3001:3001 \
-v "${CURDIR}"/../:/app \
${CONTAINER}:${TAG}
MAJOR_VERSION?=4
TAG?=18-alpine
CONTAINER?=$(shell basename $(dir $(CURDIR)))-v${MAJOR_VERSION}-buildchain
DEV_PORT?=300${MAJOR_VERSION}
IMAGE_INFO=$(shell docker image inspect $(CONTAINER):$(TAG))
IMAGE_NAME=${CONTAINER}:${TAG}
DOCKER_RUN=docker container run --rm -it --network plugindev_default -v "${CURDIR}"/../:/app

.PHONY: build dev docker install clean npm
.PHONY: build clean dev image-build image-check npm ssh

# Build the production assets
build: docker install
${DOCKERRUN} \
run build
# Start up the dev server
dev: docker install
${DOCKERRUN} \
run dev
# Start the Docker container
docker:
docker build \
. \
-t ${CONTAINER}:${TAG} \
--build-arg TAG=${TAG} \
--no-cache
# Run an npm install
install: docker
${DOCKERRUN} \
install
# Remove node_modules/* & package-lock.json
# Perform a dist build via npm run build
build: image-check
${DOCKER_RUN} --name ${CONTAINER}-$@ ${IMAGE_NAME} run build
# Remove node_modules/ & package-lock.json
clean:
rm -rf node_modules/
rm -f package-lock.json
# Run the development server via npm run dev
dev: image-check
${DOCKER_RUN} --name ${CONTAINER}-$@ -e DEV_PORT="${DEV_PORT}" -p ${DEV_PORT}:${DEV_PORT} ${IMAGE_NAME} run dev
# Build the Docker image & run npm install
image-build:
docker build . -t ${IMAGE_NAME} --build-arg TAG=${TAG} --no-cache
${DOCKER_RUN} --name ${CONTAINER}-$@ ${IMAGE_NAME} install
# Ensure the image has been created
image-check:
ifeq ($(IMAGE_INFO), [])
image-check: image-build
endif
# Run the passed in npm command
npm: docker
${DOCKERRUN} \
$(filter-out $@,$(MAKECMDGOALS))
npm: image-check
${DOCKER_RUN} --name ${CONTAINER}-$@ ${IMAGE_NAME} $(filter-out $@,$(MAKECMDGOALS)) $(MAKEFLAGS)
# Open a shell inside of the container
ssh: image-check
${DOCKER_RUN} --name ${CONTAINER}-$@ --entrypoint=/bin/sh ${IMAGE_NAME}
%:
@:
# ref: https://stackoverflow.com/questions/6273608/how-to-pass-argument-to-makefile-from-command-line
Loading

0 comments on commit a424c21

Please sign in to comment.