A CodeGeek specific base image for CG Theme v2 projects with app_build containers.
1.7K
This image is created for CodeGeek-specific internal applications. It's to be used by cg_theme_v2 projects in order to 'lock in' the node build packages used in these older projects. The image supports both amd64 and arm64 platforms.
{
"name": "app_build",
"image": "codegeekdev/cg_theme_v2-app_build-node14",
"version": "latest",
"platform": ""
},
Our Docker proj tooling was patched in v1.8.3 to contain code fixes for cg_theme_v2 projects that may fail to build in the future as node packages become obsolete. These patches need to be applied to your project only once. Note that it is expected that some projects will need some minimal hand surgery after applying the reinit changes, but the goal is to fix 95% of the troubling code. Also, do not apply these patches to cg_theme_v2 multisite projects. If you haven't already done so, then reinitialize the project with the following:
$ proj reinit -t cg_theme_v2
Otherwise, just perform a normal reinitialization.
$ proj reinit
$ proj rebuild
$ proj build
$ sass-migrator division --migrate-deps ./assets/sass/main.scss
$ proj pull -pU prod
ARG IMAGE=node
ARG VERSION=14-slim
FROM ${IMAGE}:${VERSION}
WORKDIR /app
ENV PATH="/node_modules/.bin:$PATH"
# Keep THIS Dockerfile recipe in the image so we can reference this in the future.
# Same with our package.json file.
COPY Dockerfile /
COPY package.json /
# Copy the package.json file that we'll use to install packages below.
COPY package.json .
RUN mkdir /node_modules && \
ln -s /node_modules . && \
yarn install
RUN cp package*.json yarn.lock /node_modules
# Nice to have alias.
RUN echo "alias ll='ls -al'" >> ~/.bashrc
{
"name": "codegeek-theme",
"version": "2.1.1",
"private": true,
"devDependencies": {
"browser-sync": "^2.26.7",
"browser-sync-webpack-plugin": "^2.0.1",
"core-js": "^3.6.5",
"cross-env": "^7.0.2",
"cssnano": "^4.1.10",
"glob": "^7.1.6",
"import-glob": "^1.5.0",
"laravel-mix": "^6.0.11",
"lodash": "^4.17.15",
"modernizr": "^3.7.1",
"sanitize.css": "^12.0.1",
"postcss": "^8.1",
"postcss-normalize": "^9.0.0",
"prettier": "^2.0.5",
"resolve-url-loader": "^3.1.0",
"sass": "^1.32.8",
"sass-loader": "^11.0",
"svgo-loader": "^2.2.1",
"vue-template-compiler": "^2.6.11"
},
"scripts": {
"modernizr": "./node_modules/modernizr/bin/modernizr -c assets/scripts/.modernizrrc.json -d assets/scripts/modernizr.js",
"start": "npm run watch",
"dev": "npm run development",
"development": "mix",
"watch": "npm run modernizr && mix watch",
"watch-poll": "mix watch -- --watch-options-poll=1000",
"hot": "mix watch --hot --host 0.0.0.0",
"prod": "npm run production",
"production": "mix --production"
}
}
This package.json file is included in this image so as to 'lock in' these specific package versions. Your project will inherit this package.json file in your running container each time you rebuild your project. If you need to install additional packages for your project, do not edit the package.json file (in your project's root folder). Instead, install additional packages from within your /cg_config/docker/app_build/Dockerfile. For example, add a 'yarn add' command in your Dockerfile, like this:
ARG IMAGE=check-proj-config-file-for-image
ARG VERSION=check-proj-config-file-for-version
FROM ${IMAGE}:${VERSION}
ARG NAME
WORKDIR /app
ENV PROJECTNAME=${NAME}
# If you have any additional packages to install, do so here.
# We'll save the modified package[*].json files to the node_modules folder.
# When the container mounts to the /app folder, we'll lose these
# local copies. In our entrypoint.sh, we'll copy them back.
RUN yarn add @wordpress/a11y@^3.4.1 && \
cp package*.json yarn.lock /node_modules
Recipe for building this image and pushing it to the Docker Hub repo.
$ mkdir build-dir
$ cd build-dir
$ vi Dockerfile
$ vi package.json
$ docker buildx ls
NAME/NODE DRIVER/ENDPOINT STATUS BUILDKIT PLATFORMS
cg-builder * docker-container
cg-builder0 desktop-linux stopped linux/arm64*, linux/amd64*
$ docker buildx use cg-builder
Otherwise, create a new builder instance:
$ docker buildx create --name cg-builder --bootstrap --use --platform linux/arm64,linux/amd64
$ docker login -u codegeekdev
$ password: xxxxxxxx
$ docker buildx build --no-cache --push --platform linux/amd64,linux/arm64 --tag codegeekdev/cg_theme_v2-app_build-node14:1.0.0 --tag codegeekdev/cg_theme_v2-app_build-node14:latest -f Dockerfile .
$ docker buildx rm cg-builder
$ docker pull codegeekdev/cg_theme_v2-app_build-node14:latest
$ docker run -it codegeekdev/cg_theme_v2-app_build-node14 /bin/bash
$ more /Dockerfile
Content type
Image
Digest
sha256:b1b376e66…
Size
147.9 MB
Last updated
almost 3 years ago
docker pull codegeekdev/cg_theme_v2-app_build-node14