Skip to content

Commit 7301b87

Browse files
authored
[CICD-24] Improve performance by utilizing pre-built Docker Image. (#46)
* Split original dockerfile into a stable hosted base image + custom dockerfile * Add documentation to manage the Dockerfile and image * Add changeset
1 parent 94c687c commit 7301b87

File tree

4 files changed

+48
-8
lines changed

4 files changed

+48
-8
lines changed

.changeset/loud-penguins-flash.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@wpengine/github-action-wpe-site-deploy": patch
3+
---
4+
5+
Improve performance by utilizing pre-built Docker Image.

DEVELOPMENT.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,28 @@ We use [Changesets](https://github.com/changesets/changesets) to automate versio
2727
3. Approve, then "Squash and merge" the PR into `main`.
2828

2929
Merging the versioning PR will run a workflow that creates or updates all necessary tags. It will also create a new release in GitHub.
30+
31+
## Managing the Dockerfile & Docker Image
32+
33+
The base of the `Dockerfile` is hosted as a Docker image on DockerHub. The image is originally built locally from `Dockerfiles/Dockerfile` and pushed up to DockerHub.
34+
35+
The main `Dockerfile` at the project root imports the `wpengine/gha:base-stable` hosted image from DockerHub. Customizations to the image should be added below the base image for code that is updated more frequently, such as:
36+
- entrypoint.sh
37+
- exclude.txt
38+
39+
All other customizations that are updated less frequently, or managed by 3rd parties, should be added to the `base-stable` image. Rebuild and push the image to DockerHub to update the image.
40+
41+
## Updating the Docker Image
42+
The `base-stable` Docker Image will rarely need to be updated, however it may be necessary to update it manually* from time to time.
43+
44+
- Build the docker image locally:
45+
`docker build --no-cache -t wpengine/gha:base-stable Dockerfiles`
46+
47+
- Push the image to DockerHub:
48+
`docker push wpengine/gha:base-stable`
49+
50+
Once the hosted Docker image is updated, it will need to be imported (or updated) on the main project `Dockerfile`. If the Dockerhub tag name (image version) has changed, update the existing line in the project root `Dockerfile` to match the new tag name.
51+
- Update the root Docker file for the project with the latest version of the Docker Image:tagname. i.e.:
52+
`FROM wpengine/gha:base-stable`
53+
54+
_*TO DO: Process will be automated in the future._

Dockerfile

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
FROM instrumentisto/rsync-ssh:alpine3.13-r4
2-
LABEL "com.github.actions.name"="GitHub Action for WP Engine Site Deploy"
3-
LABEL "com.github.actions.description"="An action to deploy your repository to WP Engine via the SSH Gateway"
4-
LABEL "com.github.actions.icon"="upload-cloud"
5-
LABEL "com.github.actions.color"="blue"
6-
LABEL "repository"="http://github.com/wpengine/github-action-wpe-site-deploy"
7-
LABEL "maintainer"="Alex Zuniga <[email protected]>"
8-
RUN apk add bash php
1+
# Pull the base image from DockerHub.
2+
# If you need to make changes to the base image, rebuild it manually from `Dockerfiles/Dockerfile` and push to DockerHub.
3+
# TODO: Automate this process to track stable tags and custom branch tags(based on regex).
4+
FROM wpengine/gha:base-stable
5+
6+
# Add any additional directives after the import FROM wpengine/gha:base-stable
97
ADD entrypoint.sh /entrypoint.sh
108
ADD exclude.txt /exclude.txt
119
ENTRYPOINT ["/entrypoint.sh"]

Dockerfiles/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Build and push a new image to Docker Hub when changes are made to this file.
2+
# - Import the base Docker image hosted in DockerHub: https://hub.docker.com/repository/docker/wpengine/gha `FROM wpengine/gha:base-stable`
3+
# - Customizations to the image should be added for code that is updated more frequently below the base image in github-action-wpe-site-deploy/Dockerfile.
4+
5+
FROM instrumentisto/rsync-ssh:alpine3.13-r4
6+
LABEL "com.github.actions.name"="GitHub Action for WP Engine Site Deploy"
7+
LABEL "com.github.actions.description"="An action to deploy your repository to WP Engine via the SSH Gateway"
8+
LABEL "com.github.actions.icon"="upload-cloud"
9+
LABEL "com.github.actions.color"="blue"
10+
LABEL "repository"="http://github.com/wpengine/github-action-wpe-site-deploy"
11+
LABEL "maintainer"="Alex Zuniga <[email protected]>"
12+
RUN apk add bash php

0 commit comments

Comments
 (0)