Skip to content

fix(wp2static): Downloads WP2Static plugins from repo releases #58

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
ARG aws_account_id
ARG aws_region
ARG ecr_repo_name
ARG wp2static_version
ARG wp2static_s3_addon_version

FROM ${aws_account_id}.dkr.ecr.${aws_region}.amazonaws.com/${ecr_repo_name}:base
COPY ["wp-cli.phar", "serverless-wordpress-wp2static.zip","serverless-wordpress-s3-addon.zip","/tmp/"]
COPY ["wp-cli.phar", "/tmp/"]
COPY docker-entrypoint.sh /usr/local/bin/
RUN apt-get update && apt-get install -y sudo jq awscli mariadb-client && chmod +x /usr/local/bin/docker-entrypoint.sh && chmod +x /tmp/wp-cli.phar && mv /tmp/wp-cli.phar /usr/local/bin/wp \
&& rm -rf /var/lib/apt/lists/*

RUN curl https://github.com/WP2Static/wp2static/archive/refs/tags/${wp2static_version}.zip -o /tmp/serverless-wordpress-wp2static.zip
RUN curl https://github.com/leonstafford/wp2static-addon-s3/archive/refs/tags/${wp2static_s3_addon_version}.zip -o /tmp/serverless-wordpress-s3-addon.zip

RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
COPY ["php.ini", "$PHP_INI_DIR/conf.d/"]
4 changes: 3 additions & 1 deletion modules/codebuild/codebuild_files/buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ phases:
docker build -t $IMAGE_REPO_NAME:$IMAGE_TAG --build-arg
aws_account_id=$AWS_ACCOUNT_ID --build-arg
aws_region=$AWS_DEFAULT_REGION --build-arg
ecr_repo_name=$IMAGE_REPO_NAME -f Dockerfile_serverless_wordpress .
ecr_repo_name=$IMAGE_REPO_NAME --build-arg
wp2static_version=$WP2STATIC_VERSION --build-arg
wp2static_s3_addon_version=$WP2STATIC_S3_ADDON_VERSION -f Dockerfile_serverless_wordpress .
# yamllint disable-line rule:line-length
- docker tag $IMAGE_REPO_NAME:$IMAGE_TAG $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$IMAGE_REPO_NAME:$IMAGE_TAG
post_build:
Expand Down
Binary file not shown.
Binary file not shown.
8 changes: 8 additions & 0 deletions modules/codebuild/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,14 @@ resource "aws_codebuild_project" "wordpress_docker_build" {
name = "IMAGE_TAG"
value = "latest"
}
environment_variable {
name = "WP2STATIC_VERSION"
value = var.wp2static_version
}
environment_variable {
name = "WP2STATIC_S3_ADDON_VERSION"
value = var.wp2static_s3_addon_version
}
}

logs_config {
Expand Down
12 changes: 12 additions & 0 deletions modules/codebuild/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,15 @@ variable "graviton_codebuild_enabled" {
default = false
description = "Flag that controls whether CodeBuild should use Graviton-based build agents in [supported regions](https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-compute-types.html)."
}

variable "wp2static_version" {
type = string
description = "Version of WP2Static to use from https://github.com/leonstafford/wp2static/releases"
default = "7.1.7"
}

variable "wp2static_s3_addon_version" {
type = string
description = "Version of the WP2Static S3 Add-on to use from https://github.com/leonstafford/wp2static-addon-s3/releases/"
default = "1.0"
}