Sign inSign up

codegeekdev/intelie-app_build-node12

By codegeekdev

•Updated over 2 years ago

This is a node12 image with the build tools for the Viasat Intelie project preinstalled

Image
Developer tools
0

454

codegeekdev/intelie-app_build-node12 repository overview

⁠Quick reference

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.

  • Maintained by:
    CodeGeek⁠, a Fort Collins, Colorado company specializing in custom website design and development.

⁠How To Use This Image

  1. Edit your project-config.json with your desired WP and PHP versions. Also, update the following lines to include this image for your app_build.
    {
      "name": "app_build",
      "image": "codegeekdev/intelie-app_build-node12",
      "version": "latest",
      "platform": ""
    },
  1. Reinitialize the project.

This is a custom image built specifically for the Viasat Intelie project. The repo for this project should be current with this image. Otherwise, just perform a normal reinitialization.

$ proj reinit
  1. Rebuild the project.
$ proj rebuild
  1. Build the project's assets.
$ proj build
  1. Pull the live website.
$ proj pull -pU prod
  1. Test the site. Once your testing is successful, commit and push the file changes to the Git repository.

⁠This Image is Built with the Following Dockerfile

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 \
    @babel/core@^7.13.8 \
    @babel/preset-env@^7.13.8 \
    @babel/register@^7.13.8 \
    @wordpress/eslint-plugin@^8.0.2 \
    autoprefixer@^10.2.4 \
    babel-eslint@^10.1.0 \
    babel-loader@^8.2.2 \
    browser-sync@^2.26.14 \
    del@^6.0.0 \
    eslint@^7.2.0 \
    eslint-config-airbnb-base@^14.2.1 \
    eslint-config-prettier@^8.1.0 \
    eslint-plugin-import@^2.22.1 \
    eslint-plugin-jsx-a11y@^6.4.1 \
    eslint-plugin-prettier@^3.3.1 \
    eslint-plugin-react@^7.22.0 \
    gulp@^4.0.2 \
    gulp-clean-css@^4.3.0 \
    gulp-if@^3.0.0 \
    gulp-imagemin@^7.1.0 \
    gulp-postcss@^5.1.10 \
    gulp-sass@^4.1.0 \
    gulp-sourcemaps@^3.0.0 \
    gulp-zip@^5.0.2 \
    postcss@^8.2.6 \
    prettier@^2.2.1 \
    vinyl-named@^1.1.0 \
    webpack-stream@^6.1.2 \
    yargs@^16.2.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

⁠Building this Image

Recipe for building this image and pushing it to the Docker Hub repo.

  1. Copy and paste the contents of the above Dockerfile into a new Dockerfile. Edit any changes, including Node version, etc.
$ mkdir build-dir 
$ cd build-dir
$ vi Dockerfile
  1. Determine if we've already created a Docker builder instance. Note: buildx enhances the Docker build tool, allowing us to build multi-platform images.
$ docker buildx ls

NAME/NODE       DRIVER/ENDPOINT  STATUS  BUILDKIT             PLATFORMS
cg-builder *    docker-container                              
  cg-builder0   desktop-linux    stopped                      linux/arm64*, linux/amd64*
  1. If the builder instance name 'cg-builder' is listed, then run:
$ docker buildx use cg-builder

Otherwise, create a new builder instance:

$ docker buildx create --name cg-builder --bootstrap --use --platform linux/arm64,linux/amd64
  1. Login to Docker Hub on the command line.
$ docker login -u codegeekdev
$ password: xxxxxxxx
  1. Build and push the image to Docker Hub under this account. Note: Replace the image tag with the new version. See Docker Multi-platform build instructions⁠.
$ docker buildx build --no-cache --push --platform linux/amd64,linux/arm64 --tag codegeekdev/intelie-app_build-node12:1.0.0 --tag codegeekdev/intelie-app_build-node12:latest -f Dockerfile .
  1. Delete the builder instance you created above. This will reset the Docker build driver to the default.
$ docker buildx rm cg-builder

⁠To Shell into a Container using this Image

  1. Pull the image locally.
$ docker pull codegeekdev/intelie-app_build-node12:latest
  1. Start a container that we will shell into.
$ docker run -it codegeekdev/intelie-app_build-node12 /bin/bash
  1. View the contents of the Dockerfile that we store, etc.
$ more /Dockerfile

Tag summary

Content type

Image

Digest

sha256:2a148dd1d…

Size

440 MB

Last updated

over 2 years ago

docker pull codegeekdev/intelie-app_build-node12