Sign inSign up

codegeekdev/ritdye-app_build

By codegeekdev

•Updated almost 3 years ago

A CodeGeek specific base image for the RitDye 2017 WordPress theme project app_build container.

Image
0

370

codegeekdev/ritdye-app_build repository overview

⁠Quick reference

This image is created for CodeGeek-specific internal applications. It's to be used by the RitDye (2017) WordPress theme project in order to 'lock in' the node build packages used in this 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/ritdye-app_build",
      "version": "latest",
      "platform": ""
    },
  1. Reinitialize the project.
$ proj reinit
  1. Rebuild the project.
$ proj rebuild
  1. Build the project's assets.
$ proj build
  1. Pull the live website.
$ proj pull -mpU 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

# PHP required by BrightBrightGreat's grunt-php Grunt helper
# So we're starting with a PHP image and adding nodejs
ARG IMAGE=php
ARG VERSION=7.4-cli

FROM ${IMAGE}:${VERSION}

ENV PATH="/node_modules/.bin:$PATH"

RUN apt-get update && \
    apt-get install -yq git ca-certificates gnupg curl zip

RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
    echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
    curl -fsSL https://deb.nodesource.com/setup_14.x | bash - && \
    apt-get update && \
    apt-get install -yq nodejs

WORKDIR /app

# Keep THIS Dockerfile recipe in the image so we can reference this in the future.
COPY Dockerfile /

RUN mkdir /node_modules && \
    ln -s /node_modules .

RUN npm init --yes

RUN npm install --save-dev \
        autoprefixer@^9 \
        cssnano@^4 \
        grunt@^1.0.0 \
        grunt-contrib-clean@^1.* \
        grunt-contrib-compress@* \
        grunt-contrib-uglify-es@https://github.com/gruntjs/grunt-contrib-uglify.git#harmony \
        grunt-contrib-watch@* \
        grunt-eslint@* \
        grunt-modernizr@* \
        grunt-notify@* \
        grunt-postcss@* \
        grunt-sass@* \
        grunt-sass-globbing@* \
        grunt-svgmin@^6.0.1\
        load-grunt-config@* \
        load-grunt-tasks@* \
        node-sass@* \
        postcss-fixes@^2.0.1 \
        postscribe@^2.0.8 \
        video.js@^7.5.4

RUN npm install --save-prod \
        growl@^1.10.3 \
        grunt-contrib-sass@^1.0.0

# Backup our package*.json files. When the container starts, the local theme folder will be
# mounted to /app, thereby overriding these files. In your entrypoint.sh, be sure to move them
# back.
RUN cp package*.json /node_modules

# Nice to have alias.
RUN echo "alias ll='ls -al'" >> ~/.bashrc

⁠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.
$ 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. We need this for AMD and ARM platforms.
$ 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/ritdye-app_build:1.0.0 --tag codegeekdev/ritdye-app_build:latest -f Dockerfile .

⁠To Shell into a Container using this Image

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

Tag summary

Content type

Image

Digest

sha256:766a34ae7…

Size

319.8 MB

Last updated

almost 3 years ago

docker pull codegeekdev/ritdye-app_build