Skip to content

Commit 07716f9

Browse files
kraftbjanomiex
andauthored
Adding a docker-based dev env (#40934)
Co-authored-by: Brad Jorsch <[email protected]>
1 parent dd7f917 commit 07716f9

22 files changed

+757
-3
lines changed
+100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: Build Monorepo Docker
2+
on:
3+
push:
4+
branches: [ 'trunk' ]
5+
paths:
6+
- 'tools/docker/Dockerfile.monorepo'
7+
- 'tools/docker/bin/monorepo'
8+
- '.github/versions.sh'
9+
- '.github/workflows/build-docker-monorepo.yml'
10+
pull_request:
11+
paths:
12+
- 'tools/docker/Dockerfile.monorepo'
13+
- 'tools/docker/bin/monorepo'
14+
- '.github/versions.sh'
15+
- '.github/workflows/build-docker-monorepo.yml'
16+
concurrency:
17+
group: build-docker-monorepo-${{ github.event_name }}-${{ github.ref }}
18+
cancel-in-progress: true
19+
20+
jobs:
21+
build:
22+
name: Build and publish Jetpack Monorepo Environment
23+
runs-on: ubuntu-latest
24+
permissions:
25+
packages: write
26+
contents: read
27+
timeout-minutes: 60
28+
29+
steps:
30+
- uses: actions/checkout@v4
31+
32+
- name: Set up qemu
33+
uses: docker/setup-qemu-action@v3
34+
with:
35+
platforms: arm64
36+
37+
- name: Set up Docker Buildx
38+
uses: docker/setup-buildx-action@v3
39+
40+
- name: Log in to Docker Hub
41+
uses: docker/login-action@v3
42+
with:
43+
username: matticbot
44+
password: ${{ secrets.DOCKER_HUB_MATTICBOT_TOKEN }}
45+
46+
- name: Log in to GitHub Packages
47+
uses: docker/login-action@v3
48+
with:
49+
registry: ghcr.io
50+
username: ${{ github.actor }}
51+
password: ${{ secrets.GITHUB_TOKEN }}
52+
53+
- name: Fetch build args
54+
id: buildargs
55+
run: |
56+
source .github/versions.sh
57+
source .github/files/gh-funcs.sh
58+
59+
gh_set_output php-version "$PHP_VERSION"
60+
gh_set_output composer-version "$COMPOSER_VERSION"
61+
gh_set_output node-version "$NODE_VERSION"
62+
gh_set_output pnpm-version "$PNPM_VERSION"
63+
64+
if [[ "$GITHUB_EVENT_NAME" == "push" ]]; then
65+
gh_set_output tags "type=raw,latest"
66+
gh_set_output images $'automattic/jetpack-monorepo\nghcr.io/automattic/jetpack-monorepo'
67+
elif [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]; then
68+
gh_set_output tags "type=ref,event=pr"
69+
gh_set_output images "ghcr.io/automattic/jetpack-monorepo"
70+
else
71+
echo "Unknown GITHUB_EVENT_NAME $GITHUB_EVENT_NAME"
72+
exit 1
73+
fi
74+
75+
- name: Extract Docker metadata
76+
id: meta
77+
uses: docker/metadata-action@v5
78+
with:
79+
flavor: latest=false
80+
tags: ${{ steps.buildargs.outputs.tags }}
81+
images: ${{ steps.buildargs.outputs.images }}
82+
labels: |
83+
org.opencontainers.image.title=Jetpack Monorepo Environment
84+
org.opencontainers.image.description=Environment for building and testing the Jetpack Monorepo.
85+
org.opencontainers.image.documentation=${{ github.server_url }}/${{ github.repository }}/blob/trunk/tools/docker/README.md
86+
87+
- name: Build and push Docker image
88+
uses: docker/build-push-action@v6
89+
with:
90+
context: tools/docker
91+
file: tools/docker/Dockerfile.monorepo
92+
push: true
93+
tags: ${{ steps.meta.outputs.tags }}
94+
labels: ${{ steps.meta.outputs.labels }}
95+
platforms: linux/arm64,linux/amd64
96+
build-args: |
97+
PHP_VERSION=${{ steps.buildargs.outputs.php-version }}
98+
COMPOSER_VERSION=${{ steps.buildargs.outputs.composer-version }}
99+
NODE_VERSION=${{ steps.buildargs.outputs.node-version }}
100+
PNPM_VERSION=${{ steps.buildargs.outputs.pnpm-version }}

.github/workflows/e2e-tests.yml

+1
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ jobs:
211211
CONFIG_KEY: ${{ secrets.E2E_CONFIG_KEY }}
212212
SUITE: ${{ matrix.suite }}
213213
PROJECT_NAME: ${{ matrix.project }}
214+
HOST_CWD: ${{ github.workspace }}
214215
run: |
215216
echo "::group::Decrypt config"
216217
pnpm run config:decrypt

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,6 @@ phpcs.xml
5757
# VS Code setting files
5858
*.code-workspace
5959
/.vscode/settings.json
60+
61+
.pnpm-debug.log
62+
.pnpm-error.log

pnpm-workspace.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
packages:
22
- 'projects/*/*'
3+
- '!projects/js-packages/jetpack-cli'
34
- 'projects/plugins/*/tests/e2e'
45
- 'tools/cli'
56
- 'tools/e2e-commons'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Files not needed to be distributed in the package.
2+
.gitattributes export-ignore
3+
node_modules export-ignore
4+
5+
# Files to exclude from the mirror repo
6+
/changelog/** production-exclude
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
vendor/
2+
node_modules/
3+
package-lock.json
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Jetpack
2+
3+
4+
## How to install Jetpack plugin on your site
5+
### Installation From Git Repo
6+
7+
## Contribute
8+
9+
## Get Help
10+
11+
## Security
12+
13+
Need to report a security vulnerability? Go to [https://automattic.com/security/](https://automattic.com/security/) or directly to our security bug bounty site [https://hackerone.com/automattic](https://hackerone.com/automattic).
14+
15+
## License
16+
17+
Licensed under [GNU General Public License v2 (or later)](./LICENSE.txt).
18+

0 commit comments

Comments
 (0)