-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use pre-built fpm container image (#1145)
* feat: use pre-built fpm container image Signed-off-by: Adrien Mannocci <adrien.mannocci@elastic.co> * fix: docker login before build phase Signed-off-by: Adrien Mannocci <adrien.mannocci@elastic.co> * ci: inherit secrets from upstream workflow Signed-off-by: Adrien Mannocci <adrien.mannocci@elastic.co> * ci(fix): docker login for test packages too Signed-off-by: Adrien Mannocci <adrien.mannocci@elastic.co> * feat: build container image in the project itself Signed-off-by: Adrien Mannocci <adrien.mannocci@elastic.co> * ci: enable cache build on push for testing purpose Signed-off-by: Adrien Mannocci <adrien.mannocci@elastic.co> * chore: push only latest Signed-off-by: Adrien Mannocci <adrien.mannocci@elastic.co> * fix: correct container tags Signed-off-by: Adrien Mannocci <adrien.mannocci@elastic.co> * ci: switch to github packages Signed-off-by: Adrien Mannocci <adrien.mannocci@elastic.co> * ci: disable push publish Signed-off-by: Adrien Mannocci <adrien.mannocci@elastic.co> * fix: correct permissions Signed-off-by: Adrien Mannocci <adrien.mannocci@elastic.co> * fix: correct permissions Signed-off-by: Adrien Mannocci <adrien.mannocci@elastic.co> * ci: add version in comments Signed-off-by: Adrien Mannocci <adrien.mannocci@elastic.co> * ci: use hardcode literal when useful Signed-off-by: Adrien Mannocci <adrien.mannocci@elastic.co> * ci: use a less specific tag Signed-off-by: Adrien Mannocci <adrien.mannocci@elastic.co> * ci: test package before publishing the container image Signed-off-by: Adrien Mannocci <adrien.mannocci@elastic.co> * ci: re-enable cache on push Signed-off-by: Adrien Mannocci <adrien.mannocci@elastic.co> * ci: forward test image tag Signed-off-by: Adrien Mannocci <adrien.mannocci@elastic.co> * fix: forward correctly image tag Signed-off-by: Adrien Mannocci <adrien.mannocci@elastic.co> * fix: push to env instead of output Signed-off-by: Adrien Mannocci <adrien.mannocci@elastic.co> * fix: tag correctly test container image Signed-off-by: Adrien Mannocci <adrien.mannocci@elastic.co> * ci: cleanup Signed-off-by: Adrien Mannocci <adrien.mannocci@elastic.co> --------- Signed-off-by: Adrien Mannocci <adrien.mannocci@elastic.co>
- Loading branch information
Showing
8 changed files
with
135 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
--- | ||
name: Build Cached Container Images | ||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "0 3 * * 1-5" | ||
|
||
env: | ||
DOCKER_BUILDKIT: 1 | ||
IMAGE_NAME: ${{ github.repository }} | ||
REGISTRY: ghcr.io | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
uses: ./.github/workflows/build.yml | ||
|
||
publish: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- build | ||
permissions: | ||
packages: write | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: package-parts-linux-x86-64 | ||
path: agent/native/_build/linux-x86-64-release/ | ||
|
||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: package-parts-linuxmusl-x86-64 | ||
path: agent/native/_build/linuxmusl-x86-64-release/ | ||
|
||
- name: Create a unique tag | ||
run: | | ||
echo "TEST_TAG=$(date +%s)" >> "${GITHUB_ENV}" | ||
- name: Extract metadata (tags, labels) for Test Container | ||
id: test-meta | ||
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
tags: | | ||
type=raw,value=${{ env.TEST_TAG }} | ||
- name: Build and export Container image | ||
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0 | ||
with: | ||
context: ./packaging/cache/ | ||
load: true | ||
tags: ${{ steps.test-meta.outputs.tags }} | ||
labels: ${{ steps.test-meta.outputs.labels }} | ||
|
||
- name: Package | ||
run: make IMAGE_TAG=${{ env.TEST_TAG }} -C packaging package | ||
|
||
- name: Package info | ||
run: make IMAGE_TAG=${{ env.TEST_TAG }} -C packaging info | ||
|
||
- name: Extract metadata (tags, labels) for Container | ||
id: meta | ||
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
tags: | | ||
type=raw,value=latest | ||
- name: Log in to the Container registry | ||
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0 | ||
with: | ||
context: ./packaging/cache/ | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,5 @@ | ||
FROM ruby:3.3.0-alpine3.18 | ||
|
||
ENV FPM_VERSION 1.15.1 | ||
RUN apk add --no-cache \ | ||
alpine-sdk make cpio curl libarchive-tools make php-pear \ | ||
python3 py3-virtualenv py3-setuptools py3-pip \ | ||
rpm unzip xz git tar dpkg \ | ||
&& ln -sf python3 /usr/bin/python \ | ||
&& gem install --no-document fpm -v ${FPM_VERSION} | ||
|
||
## Fix fpm issue, see https://github.com/jordansissel/fpm/issues/1227 | ||
ADD fpm_apm.patch /tmp | ||
RUN (cd /usr/local/bundle/gems/fpm-${FPM_VERSION}/ ; patch -p 1 < /tmp/fpm_apm.patch ) \ | ||
&& rm -f /tmp/fpm_apk.patch | ||
|
||
ARG IMAGE_TAG=latest | ||
FROM ghcr.io/elastic/apm-agent-php:${IMAGE_TAG} | ||
COPY create-package.sh /bin | ||
WORKDIR /app | ||
ENTRYPOINT ["/bin/create-package.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
FROM ruby:3.3-alpine | ||
|
||
ENV FPM_VERSION 1.15.1 | ||
RUN apk add --no-cache \ | ||
alpine-sdk make cpio curl libarchive-tools make php-pear \ | ||
python3 py3-virtualenv py3-setuptools py3-pip \ | ||
rpm unzip xz git tar dpkg \ | ||
&& ln -sf python3 /usr/bin/python \ | ||
&& gem install --no-document fpm -v ${FPM_VERSION} | ||
|
||
## Fix fpm issue, see https://github.com/jordansissel/fpm/issues/1227 | ||
ADD fpm_apm.patch /tmp | ||
RUN (cd /usr/local/bundle/gems/fpm-${FPM_VERSION}/ ; patch -p 1 < /tmp/fpm_apm.patch ) \ | ||
&& rm -f /tmp/fpm_apk.patch |
File renamed without changes.