Skip to content

Commit

Permalink
Add build for publish images
Browse files Browse the repository at this point in the history
  • Loading branch information
bdhoine committed Nov 22, 2024
1 parent 4dbf544 commit 73bd364
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 20 deletions.
15 changes: 9 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Create and publish a Docker image
name: Create and publish AEM images

on:
push:
Expand All @@ -12,13 +12,16 @@ env:

jobs:
build-and-push-image:
name: Build and push image
name: Build and push AEM image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
strategy:
matrix:
runmode: ["author", "publish"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -44,20 +47,20 @@ jobs:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
- name: Extract metadata
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
- name: Build and push docker image
id: push
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}:${{ env.AEM_SDK_VERSION }}
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}:${{ matrix.runmode }}-${{ env.AEM_SDK_VERSION }}
platforms: linux/amd64
# platforms: linux/amd64,linux/arm64
# TODO: for multi platform use: linux/amd64,linux/arm64
labels: ${{ steps.meta.outputs.labels }}
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
.idea
aem-sdk-*.zip
aem-sdk-artifacts
15 changes: 9 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,23 @@ RUN curl -L https://github.com/wttech/aemc/releases/download/v${AEMC_VERSION}/ae

FROM azul/zulu-openjdk:11-jre-headless

ARG RUNMODE=author
ARG PORT=4502

ENV RUNMODE=${RUNMODE}
ENV AEM_VENDOR_JAVA_HOME_DIR=$JAVA_HOME

COPY --from=installer /usr/local/bin/aem /usr/local/bin/aem

EXPOSE 4502
EXPOSE ${PORT}

WORKDIR /opt

COPY aem-start.sh /usr/local/bin/aem-start

COPY aem-sdk-artifacts/aem-sdk-*.zip aem/home/lib/

RUN chmod +x /usr/local/bin/aem-start

ENV AEM_VENDOR_JAVA_HOME_DIR=$JAVA_HOME
COPY aem-sdk-artifacts/aem-sdk-*.zip aem/home/lib/

RUN aem instance -A launch && aem instance down
RUN aem instance --instance-${RUNMODE} launch && aem instance down

CMD ["/usr/local/bin/aem-start"]
59 changes: 55 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,62 @@
# AEM SDK

Docker images with AEMaaCS SDK.
AEM author and publish docker images for AEMaaCS using the AEM SDK.

## How to use
## Pull the image

### Pull the image
The `version` should be in the original format like `2024.10.18459.20241031T210302Z-241000`.

To pull the author image

```shell
docker pull ghcr.io/orbinson/aem-sdk:author-<version>
```

To pull the publish image

```shell
docker pull ghcr.io/orbinson/aem-sdk:publish-<version>
```

## Development

First you need to get the artifacts from the private [aem-sdk-artifacts](https://github.com/orbinson/aem-sdk-artifacts) repository.

```shell
git clone [email protected]:orbinson/aem-sdk-artifacts.git
git lfs pull
```

Or create the `aem-sdk-artifacts` directory and copy the artifacts there from your Downloads folder for example.

```shell
docker pull ghcr.io/orbinson/aem-sdk:main
mkdir aem-sdk-artifacts
mv ~/Downloads/aem-sdk-*.zip aem-sdk-artifacts/
```

Afterward you can build the image, by default and author is built.

```shell
docker build . -t aem-sdk:author
```

And run the image

```shell
docker run -p 4502:4502 aem-sdk:author
```

To build the publish image, you need to specify the correct build arguments.

```shell
docker build \
--build-arg RUNMODE=publish \
--build-arg PORT=4503 \
. -t aem-sdk:publish
```

And run the image

```shell
docker run -p 4503:4503 aem-sdk:publish
```
6 changes: 3 additions & 3 deletions aem-start.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/usr/bin/env sh

aem_stop() {
/usr/local/bin/aem instance -A stop
/usr/local/bin/aem instance --instance-${RUNMODE} stop
exit 0
}

trap aem_stop INT TERM

/usr/local/bin/aem instance -A start
/usr/local/bin/aem instance --instance-${RUNMODE} start

tail -F /opt/aem/home/var/instance/author/crx-quickstart/logs/error.log
tail -F /opt/aem/home/var/instance/${RUNMODE}/crx-quickstart/logs/error.log

0 comments on commit 73bd364

Please sign in to comment.