A CodeGeek specific base image for CG Theme v1 projects with app_build containers.
1.7K
This image is created for CodeGeek-specific internal applications. It's to be used by cg_theme_v1 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_v1-app_build-node14",
"version": "latest",
"platform": ""
},
Our Docker proj tooling was patched in v1.7.12 to contain code fixes for cg_theme_v1 projects that fail to build due to references to Ruby, Compass, and other obsolete packages. 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_v1 multisite projects. If you haven't already done so, then reinitialize the project with the following:
$ proj reinit -t cg_theme_v1
Otherwise, just perform a normal reinitialization.
$ proj reinit
$ proj rebuild
$ proj build
Install Sass Migrator into the app_build container:
$ proj shell app_build
$ npm install sass-migrator
$ sass-migrator division --migrate-deps ./assets/sass/main.scss
$ exit
$ proj pull -pU prod
ARG IMAGE=node
ARG VERSION=14
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.
COPY Dockerfile /
# Install our node modules.
# 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 your entrypoint.sh, copy them back.
RUN mkdir /node_modules && \
ln -s /node_modules . && \
npm init --yes && \
npm install --save-dev \
bower@^1.8.14 \
browser-sync@^2.29.3 \
grunt@^0.4.5 \
grunt-browser-sync@^2.1.3 \
grunt-cli@^1.4.3 \
grunt-contrib-concat@~0.5.0 \
grunt-contrib-jshint@~0.10.0 \
grunt-contrib-uglify@~0.5.0 \
grunt-contrib-watch@~0.6.1 \
grunt-dart-sass@^2.0.1 \
grunt-wp-assets@~0.2.6 \
load-grunt-tasks@~0.6.0 \
lodash@^4.17.21 \
sass@^1.69.5 \
time-grunt@~0.4.0 && \
cp package*.json /node_modules
# Nice to have alias.
RUN echo "alias ll='ls -al'" >> ~/.bashrc
Note: The Dockerfile above will create a package.json file that will 'lock in' 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 'npm install' 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 npm install --save-dev @wordpress/a11y@^3.4.1 && \
cp package*.json /node_modules
Recipe for building this image and pushing it to the Docker Hub repo.
$ mkdir build-dir
$ cd build-dir
$ vi Dockerfile
$ 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_v1-app_build-node14:1.0.0 --tag codegeekdev/cg_theme_v1-app_build-node14:latest -f Dockerfile .
$ docker buildx rm cg-builder
$ docker pull codegeekdev/cg_theme_v1-app_build-node14:latest
$ docker run -it codegeekdev/cg_theme_v1-app_build-node14 /bin/bash
$ more /Dockerfile
Content type
Image
Digest
sha256:b29697cb9…
Size
367.3 MB
Last updated
almost 3 years ago
docker pull codegeekdev/cg_theme_v1-app_build-node14