Skip to content

Commit 2055ea5

Browse files
authored
fix(wp2static): Downloads WP2Static plugins from repo releases (#58)
1 parent 3a5fb55 commit 2055ea5

File tree

6 files changed

+29
-2
lines changed

6 files changed

+29
-2
lines changed
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
ARG aws_account_id
22
ARG aws_region
33
ARG ecr_repo_name
4+
ARG wp2static_version
5+
ARG wp2static_s3_addon_version
46

57
FROM ${aws_account_id}.dkr.ecr.${aws_region}.amazonaws.com/${ecr_repo_name}:base
6-
COPY ["wp-cli.phar", "serverless-wordpress-wp2static.zip","serverless-wordpress-s3-addon.zip","/tmp/"]
8+
COPY ["wp-cli.phar", "/tmp/"]
79
COPY docker-entrypoint.sh /usr/local/bin/
810
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 \
911
&& rm -rf /var/lib/apt/lists/*
1012

13+
RUN curl https://github.com/WP2Static/wp2static/archive/refs/tags/${wp2static_version}.zip -o /tmp/serverless-wordpress-wp2static.zip
14+
RUN curl https://github.com/leonstafford/wp2static-addon-s3/archive/refs/tags/${wp2static_s3_addon_version}.zip -o /tmp/serverless-wordpress-s3-addon.zip
15+
1116
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
1217
COPY ["php.ini", "$PHP_INI_DIR/conf.d/"]

modules/codebuild/codebuild_files/buildspec.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ phases:
2121
docker build -t $IMAGE_REPO_NAME:$IMAGE_TAG --build-arg
2222
aws_account_id=$AWS_ACCOUNT_ID --build-arg
2323
aws_region=$AWS_DEFAULT_REGION --build-arg
24-
ecr_repo_name=$IMAGE_REPO_NAME -f Dockerfile_serverless_wordpress .
24+
ecr_repo_name=$IMAGE_REPO_NAME --build-arg
25+
wp2static_version=$WP2STATIC_VERSION --build-arg
26+
wp2static_s3_addon_version=$WP2STATIC_S3_ADDON_VERSION -f Dockerfile_serverless_wordpress .
2527
# yamllint disable-line rule:line-length
2628
- docker tag $IMAGE_REPO_NAME:$IMAGE_TAG $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$IMAGE_REPO_NAME:$IMAGE_TAG
2729
post_build:
Binary file not shown.
Binary file not shown.

modules/codebuild/main.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,14 @@ resource "aws_codebuild_project" "wordpress_docker_build" {
129129
name = "IMAGE_TAG"
130130
value = "latest"
131131
}
132+
environment_variable {
133+
name = "WP2STATIC_VERSION"
134+
value = var.wp2static_version
135+
}
136+
environment_variable {
137+
name = "WP2STATIC_S3_ADDON_VERSION"
138+
value = var.wp2static_s3_addon_version
139+
}
132140
}
133141

134142
logs_config {

modules/codebuild/variables.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,15 @@ variable "graviton_codebuild_enabled" {
6363
default = false
6464
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)."
6565
}
66+
67+
variable "wp2static_version" {
68+
type = string
69+
description = "Version of WP2Static to use from https://github.com/leonstafford/wp2static/releases"
70+
default = "7.1.7"
71+
}
72+
73+
variable "wp2static_s3_addon_version" {
74+
type = string
75+
description = "Version of the WP2Static S3 Add-on to use from https://github.com/leonstafford/wp2static-addon-s3/releases/"
76+
default = "1.0"
77+
}

0 commit comments

Comments
 (0)