-
Notifications
You must be signed in to change notification settings - Fork 0
support ARM64 with official Ruby + jemalloc #22
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -3,7 +3,7 @@ name: Build and Publish | |||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||
| create: | ||||||||||||||||||||||||||||
| tags: | ||||||||||||||||||||||||||||
| - '*' | ||||||||||||||||||||||||||||
| - '*' | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||
| build-and-push-docker-image: | ||||||||||||||||||||||||||||
|
|
@@ -12,24 +12,73 @@ jobs: | |||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||
| - name: Checkout code | ||||||||||||||||||||||||||||
| uses: actions/checkout@v2 | ||||||||||||||||||||||||||||
| uses: actions/checkout@v4 | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| - name: Set up QEMU | ||||||||||||||||||||||||||||
| uses: docker/setup-qemu-action@v3 | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| - name: Set up Docker Buildx | ||||||||||||||||||||||||||||
| uses: docker/setup-buildx-action@v3 | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| - name: Docker meta | ||||||||||||||||||||||||||||
| id: meta | ||||||||||||||||||||||||||||
| uses: docker/metadata-action@v4 | ||||||||||||||||||||||||||||
| uses: docker/metadata-action@v5 | ||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||
| images: polydice/base | ||||||||||||||||||||||||||||
| tags: type=ref,event=tag | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| - name: Login to DockerHub | ||||||||||||||||||||||||||||
| uses: docker/login-action@v2 | ||||||||||||||||||||||||||||
| uses: docker/login-action@v3 | ||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||
| username: ${{ secrets.DOCKERHUB_USERNAME }} | ||||||||||||||||||||||||||||
| password: ${{ secrets.DOCKERHUB_TOKEN }} | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| - name: Build image and push to Docker Hub | ||||||||||||||||||||||||||||
| uses: docker/build-push-action@v3 | ||||||||||||||||||||||||||||
| - name: Build and push | ||||||||||||||||||||||||||||
| uses: docker/build-push-action@v6 | ||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||
| push: true | ||||||||||||||||||||||||||||
| context: . | ||||||||||||||||||||||||||||
| platforms: linux/amd64,linux/arm64 | ||||||||||||||||||||||||||||
| tags: ${{ steps.meta.outputs.tags }} | ||||||||||||||||||||||||||||
deltaguita marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| - name: Build and push testing variant | ||||||||||||||||||||||||||||
| uses: docker/build-push-action@v6 | ||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||
| push: true | ||||||||||||||||||||||||||||
| context: . | ||||||||||||||||||||||||||||
| tags: ${{ steps.meta.outputs.tags }} | ||||||||||||||||||||||||||||
| file: ./Dockerfile.testing | ||||||||||||||||||||||||||||
| platforms: linux/amd64,linux/arm64 | ||||||||||||||||||||||||||||
| tags: polydice/base:${{ github.ref_name }}-testing | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| sync-to-ecr: | ||||||||||||||||||||||||||||
| name: Sync to ECR Public | ||||||||||||||||||||||||||||
| needs: build-and-push-docker-image | ||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||
| if: success() | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||
|
Comment on lines
+53
to
+59
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The ECR sync job will fail if the DockerHub push fails, but there's no error handling or retry mechanism. Consider adding error handling or making the ECR sync conditional on successful DockerHub push.
Suggested change
|
||||||||||||||||||||||||||||
| - name: Configure AWS credentials | ||||||||||||||||||||||||||||
| uses: aws-actions/configure-aws-credentials@v4 | ||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||
| aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||||||||||||||||||||||||||||
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||||||||||||||||||||||||||||
| aws-region: us-east-1 | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| - name: Login to Amazon ECR Public | ||||||||||||||||||||||||||||
| uses: aws-actions/amazon-ecr-login@v2 | ||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||
| registry-type: public | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| - name: Set up Docker Buildx | ||||||||||||||||||||||||||||
| uses: docker/setup-buildx-action@v3 | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| - name: Sync multi-arch image to ECR | ||||||||||||||||||||||||||||
dlackty marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||
| set -e | ||||||||||||||||||||||||||||
| docker buildx imagetools create \ | ||||||||||||||||||||||||||||
| --tag public.ecr.aws/z1n0q3w1/base:${{ github.ref_name }} \ | ||||||||||||||||||||||||||||
| polydice/base:${{ github.ref_name }} | ||||||||||||||||||||||||||||
| docker buildx imagetools create \ | ||||||||||||||||||||||||||||
| --tag public.ecr.aws/z1n0q3w1/base:${{ github.ref_name }}-testing \ | ||||||||||||||||||||||||||||
| polydice/base:${{ github.ref_name }}-testing | ||||||||||||||||||||||||||||
| echo "Successfully synced to ECR Public" | ||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,17 +1,35 @@ | ||||||
| ARG RUBY_VERSION=2.7.8 | ||||||
| ARG VARIANT=jemalloc-slim | ||||||
| FROM quay.io/evl.ms/fullstaq-ruby:${RUBY_VERSION}-${VARIANT} as base | ||||||
| FROM ruby:${RUBY_VERSION}-slim | ||||||
|
|
||||||
| ARG BUNDLER_VERSION=2.4.20 | ||||||
| SHELL ["/bin/bash", "-o", "pipefail", "-c"] | ||||||
|
|
||||||
| # jemalloc for better memory management | ||||||
| RUN apt-get update && apt-get install -y --no-install-recommends libjemalloc2 \ | ||||||
| && JEMALLOC_PATH=$(find /usr/lib -name "libjemalloc.so.2" | head -1) \ | ||||||
| && [ -n "$JEMALLOC_PATH" ] || (echo "libjemalloc.so.2 not found" && exit 1) \ | ||||||
| && ln -sf "$JEMALLOC_PATH" /usr/lib/libjemalloc.so.2 \ | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛑 Logic Error: The symlink creation will fail if
Suggested change
|
||||||
| && rm -rf /var/lib/apt/lists/* | ||||||
deltaguita marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| ENV LD_PRELOAD=/usr/lib/libjemalloc.so.2 | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛑 Portability Issue: Hardcoded LD_PRELOAD path may not work across ARM64 and AMD64 architectures. The jemalloc library path can vary between architectures.
Suggested change
|
||||||
|
|
||||||
| # Install build tools and native extension dependencies | ||||||
| RUN apt-get update && apt-get install -y --no-install-recommends \ | ||||||
| build-essential \ | ||||||
| libpq-dev \ | ||||||
| libffi-dev \ | ||||||
| && rm -rf /var/lib/apt/lists/* | ||||||
|
|
||||||
| ARG BUNDLER_VERSION=2.4.22 | ||||||
| RUN gem install -N bundler -v ${BUNDLER_VERSION} | ||||||
|
|
||||||
| ARG NODE_VERSION=18.18.0 | ||||||
| ARG YARN_VERSION=1.22.22 | ||||||
| ARG PNPM_VERSION=9.9.0 | ||||||
| RUN curl https://get.volta.sh | bash | ||||||
| ENV VOLTA_HOME /root/.volta | ||||||
| RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certificates \ | ||||||
| && rm -rf /var/lib/apt/lists/* \ | ||||||
| && curl -fsSL https://get.volta.sh | bash | ||||||
| ENV VOLTA_HOME=/root/.volta | ||||||
| ENV VOLTA_FEATURE_PNPM=1 | ||||||
| ENV PATH $VOLTA_HOME/bin:/usr/local/bin:$PATH | ||||||
| ENV PATH=$VOLTA_HOME/bin:/usr/local/bin:$PATH | ||||||
| RUN volta install node@${NODE_VERSION} && volta install yarn@${YARN_VERSION} && volta install pnpm@${PNPM_VERSION} | ||||||
|
|
||||||
| RUN apt-get update \ | ||||||
|
|
@@ -23,28 +41,24 @@ RUN apt-get update \ | |||||
| graphicsmagick \ | ||||||
| file \ | ||||||
| tar \ | ||||||
| curl \ | ||||||
| ca-certificates \ | ||||||
| libmcrypt4 \ | ||||||
| shared-mime-info \ | ||||||
| libmcrypt4 \ | ||||||
| && rm -rf /var/lib/apt/lists/* | ||||||
|
|
||||||
| # Don't add g++/make to buildDeps, or purge will remove build-essential | ||||||
| WORKDIR /tmp | ||||||
| RUN set -ex \ | ||||||
| \ | ||||||
| && buildDeps=' \ | ||||||
| g++ \ | ||||||
| make \ | ||||||
| cmake \ | ||||||
| python \ | ||||||
| ' \ | ||||||
| && buildDeps='cmake python3' \ | ||||||
| && apt-get update \ | ||||||
| && apt-get install -y --no-install-recommends $buildDeps \ | ||||||
| && rm -rf /var/lib/apt/lists/* \ | ||||||
| \ | ||||||
| && curl -L https://github.com/BYVoid/OpenCC/archive/refs/tags/ver.1.1.9.tar.gz | tar -xz \ | ||||||
| && cd OpenCC-ver.1.1.9 \ | ||||||
| && REL_BUILD_DOCUMENTATION=OFF make install \ | ||||||
| \ | ||||||
| && apt-get purge -y --auto-remove $buildDeps \ | ||||||
| && cd ../ \ | ||||||
| && curl -L https://github.com/BYVoid/OpenCC/archive/refs/tags/ver.1.1.9.tar.gz | tar -xz | ||||||
|
|
||||||
| WORKDIR /tmp/OpenCC-ver.1.1.9 | ||||||
| RUN REL_BUILD_DOCUMENTATION=OFF make install | ||||||
|
|
||||||
| WORKDIR /tmp | ||||||
| RUN apt-get purge -y --auto-remove cmake python3 \ | ||||||
| && rm -rf OpenCC-ver.1.1.9 | ||||||
|
|
||||||
| WORKDIR /app | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| FROM polydice/base:0.32.0-rc5 | ||
|
|
||
| RUN apt-get update \ | ||
| && apt-get install -y --no-install-recommends \ | ||
| git \ | ||
| openssh-client \ | ||
| libpq-dev \ | ||
| libxml2-dev \ | ||
| libxslt1-dev \ | ||
| libsasl2-dev \ | ||
| libmcrypt-dev \ | ||
| build-essential \ | ||
| && rm -rf /var/lib/apt/lists/* |
Uh oh!
There was an error while loading. Please reload this page.