Skip to content

Commit

Permalink
Update readme and add Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
apmatthews committed Nov 22, 2022
1 parent 7e928c6 commit 8ef13c7
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 1 deletion.
23 changes: 23 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.PHONY: clean list-images build publish

IMAGE_NAME ?= wpengine/site-deploy
MAJOR_VERSION ?= 1
MINOR_VERSION ?= 0
PATCH_VERSION ?= 0
TAG ?= latest
IMAGE := $(IMAGE_NAME):$(TAG)

clean:
$(eval CURRENT_IMAGES=`docker images $(IMAGE_NAME) -a -q | uniq`)
docker rmi -f $(CURRENT_IMAGES)

list-images:
docker images $(IMAGE_NAME) -a

build:
docker build --no-cache -t $(IMAGE) ./

version: build
docker image tag $(IMAGE) $(IMAGE_NAME):v$(MAJOR_VERSION) && \
docker image tag $(IMAGE) $(IMAGE_NAME):v$(MAJOR_VERSION).$(MINOR_VERSION) && \
docker image tag $(IMAGE) $(IMAGE_NAME):v$(MAJOR_VERSION).$(MINOR_VERSION).$(PATCH_VERSION)
47 changes: 46 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,47 @@
# site-deploy
# wpengine/site-deploy
Base image to build VCS integrations enabling customers to deploy their site to WP Engine

## How to Build

You can build and version this image using make targets.

```sh
make build # Builds the image locally
make version # Builds the image and creates version tags
make list-images # Shows all tagged versions of the image
make clean # Deletes all tagged versions of the image
```

## How to Run

You can use this image to deploy a site from your local machine.

1. Build the `wpengine/site-deploy:latest` image with `make build`.
2. Change directories into the root of the local site you'd like to deploy.
3. Create a `.env` file with the following variables, changing their values as needed.

```sh
INPUT_WPE_ENV=yourinstall # The target WP Engine install name.
GITHUB_REF=main # Inconsequential, but must be defined for now.
INPUT_REMOTE_PATH=
INPUT_SRC_PATH=.
INPUT_PHP_LINT=TRUE
INPUT_CACHE_CLEAR=TRUE
```

3. Set an environment variable with your private SSH key, replacing the key file name with your own.

```sh
export INPUT_WPE_SSHG_KEY_PRIVATE=`cat ~/.ssh/my_sshg_key_rsa`
```
4. Replace `/path/to/your/install` with the absolute path to your local site and run the deploy!

```sh
docker run \
-e "INPUT_WPE_SSHG_KEY_PRIVATE" \
-e "INPUT_FLAGS=-azvr --inplace --exclude=\".*\"" \
--env-file ./.env \
-v /path/to/your/install:/site \
--workdir=/site \
wpengine/site-deploy:latest
```

0 comments on commit 8ef13c7

Please sign in to comment.