Skip to content
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

Adding a docker-based dev env #40934

Merged
merged 33 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
67296ba
Adding a docker-based dev env
kraftbj Jan 9, 2025
4391224
New CLI works with docker now -- commands will run on the local host …
kraftbj Jan 9, 2025
40d5719
Remove unneeded Docker from the dev container and put the pnpm store …
kraftbj Jan 10, 2025
5510974
Confusing the different monorepo containers, let's use the right one
kraftbj Jan 10, 2025
d244c27
No tests yet
kraftbj Jan 10, 2025
6fbd418
Try to fix the e2e tests
kraftbj Jan 10, 2025
5fe1007
Merge remote-tracking branch 'origin/trunk' into try/dev-in-docker
kraftbj Jan 10, 2025
f3ba0e7
Ensure docker is available within the container for interacting with …
kraftbj Jan 10, 2025
2c460cd
Switch logic to all docker commands run in the container, except for …
kraftbj Jan 10, 2025
0db9170
Add notification system for updates
kraftbj Jan 10, 2025
308d456
We're never expecting to have PHP tests
kraftbj Jan 10, 2025
e098e69
Ensure traditional jetpack docker up works
kraftbj Jan 10, 2025
06a24a4
Simplify
kraftbj Jan 10, 2025
409396b
Build for arm64 and amd64 when we're doing that
kraftbj Jan 10, 2025
5e8d778
Support .env for custom vars
kraftbj Jan 10, 2025
0dd5ba8
Transverse the dir tree without assuming unix dir structure
kraftbj Jan 10, 2025
3f5a875
Remove prepull. Possibly other issues, can't repro
kraftbj Jan 10, 2025
91a0a0d
Update .github/workflows/build-docker-monorepo.yml
kraftbj Jan 10, 2025
a8266cf
add qemu
kraftbj Jan 10, 2025
b68ff2b
Merge branch 'try/dev-in-docker' of github.com:Automattic/jetpack int…
kraftbj Jan 10, 2025
71f3eab
Only spin up monorepo via the executable package entry
kraftbj Jan 10, 2025
c4ca2f0
Separate docker-compose.yml
kraftbj Jan 10, 2025
c20cb23
Add new docker-composer :)
kraftbj Jan 11, 2025
4a74468
First attempt at some documentation updates
kraftbj Jan 11, 2025
aacf2e6
Merge remote-tracking branch 'origin/trunk' into try/dev-in-docker
kraftbj Jan 13, 2025
14bceb1
Add env to check if in monorepo env and disable jetpack cli {link|unl…
kraftbj Jan 13, 2025
29be249
Enable rsync support
kraftbj Jan 13, 2025
c5cde21
When testing building with npm, let's ignore the lock file too.
kraftbj Jan 13, 2025
2048987
Remove the new CLI from the pnpm workspace
kraftbj Jan 14, 2025
5cb6e82
Merge remote-tracking branch 'origin/try/dev-in-docker' into try/dev-…
kraftbj Jan 14, 2025
38ed1b1
Revert "First attempt at some documentation updates"
kraftbj Jan 14, 2025
0bf7446
Remove left over jetpack docker monorepo command
kraftbj Jan 14, 2025
155120f
Remove unused docker composer file
kraftbj Jan 14, 2025
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
94 changes: 94 additions & 0 deletions .github/workflows/build-docker-monorepo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Build Monorepo Docker
on:
push:
branches: [ 'trunk' ]
paths:
- 'tools/docker/Dockerfile.monorepo'
- 'tools/docker/bin/monorepo'
- '.github/versions.sh'
- '.github/workflows/build-docker-monorepo.yml'
pull_request:
paths:
- 'tools/docker/Dockerfile.monorepo'
- 'tools/docker/bin/monorepo'
- '.github/versions.sh'
- '.github/workflows/build-docker-monorepo.yml'
concurrency:
group: build-docker-monorepo-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
name: Build and publish Jetpack Monorepo Environment
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
timeout-minutes: 60

steps:
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
github-advanced-security[bot] marked this conversation as resolved.
Dismissed
Show resolved Hide resolved

- name: Log in to Docker Hub
uses: docker/login-action@v3
Dismissed Show dismissed Hide dismissed
with:
username: matticbot
password: ${{ secrets.DOCKER_HUB_MATTICBOT_TOKEN }}

- name: Log in to GitHub Packages
uses: docker/login-action@v3
Dismissed Show dismissed Hide dismissed
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Fetch build args
id: buildargs
run: |
source .github/versions.sh
source .github/files/gh-funcs.sh

gh_set_output php-version "$PHP_VERSION"
gh_set_output composer-version "$COMPOSER_VERSION"
gh_set_output node-version "$NODE_VERSION"
gh_set_output pnpm-version "$PNPM_VERSION"

if [[ "$GITHUB_EVENT_NAME" == "push" ]]; then
gh_set_output tags "type=raw,latest"
gh_set_output images $'automattic/jetpack-monorepo\nghcr.io/automattic/jetpack-monorepo'
elif [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]; then
gh_set_output tags "type=ref,event=pr"
gh_set_output images "ghcr.io/automattic/jetpack-monorepo"
else
echo "Unknown GITHUB_EVENT_NAME $GITHUB_EVENT_NAME"
exit 1
fi

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
Dismissed Show dismissed Hide dismissed
with:
flavor: latest=false
tags: ${{ steps.buildargs.outputs.tags }}
images: ${{ steps.buildargs.outputs.images }}
labels: |
org.opencontainers.image.title=Jetpack Monorepo Environment
org.opencontainers.image.description=Environment for building and testing the Jetpack Monorepo.
org.opencontainers.image.documentation=${{ github.server_url }}/${{ github.repository }}/blob/trunk/tools/docker/README.md

- name: Build and push Docker image
uses: docker/build-push-action@v6
Dismissed Show dismissed Hide dismissed
with:
context: tools/docker
file: tools/docker/Dockerfile.monorepo
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
PHP_VERSION=${{ steps.buildargs.outputs.php-version }}
COMPOSER_VERSION=${{ steps.buildargs.outputs.composer-version }}
NODE_VERSION=${{ steps.buildargs.outputs.node-version }}
PNPM_VERSION=${{ steps.buildargs.outputs.pnpm-version }}
1 change: 1 addition & 0 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ jobs:
CONFIG_KEY: ${{ secrets.E2E_CONFIG_KEY }}
SUITE: ${{ matrix.suite }}
PROJECT_NAME: ${{ matrix.project }}
HOST_CWD: ${{ github.workspace }}
run: |
echo "::group::Decrypt config"
pnpm run config:decrypt
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,6 @@ phpcs.xml
# VS Code setting files
*.code-workspace
/.vscode/settings.json

.pnpm-debug.log
.pnpm-error.log
18 changes: 18 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions projects/js-packages/jetpack-cli/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Files not needed to be distributed in the package.
.gitattributes export-ignore
node_modules export-ignore

# Files to exclude from the mirror repo
/changelog/** production-exclude
2 changes: 2 additions & 0 deletions projects/js-packages/jetpack-cli/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
vendor/
node_modules/
7 changes: 7 additions & 0 deletions projects/js-packages/jetpack-cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

18 changes: 18 additions & 0 deletions projects/js-packages/jetpack-cli/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Jetpack


## How to install Jetpack plugin on your site
### Installation From Git Repo

## Contribute

## Get Help

## Security

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).

## License

Licensed under [GNU General Public License v2 (or later)](./LICENSE.txt).

Loading
Loading