Skip to content

Commit 1a98ebf

Browse files
committed
feat: super optimizes Dockerfile.node-aws, fixes build on arm
1 parent 60523d2 commit 1a98ebf

File tree

3 files changed

+24
-22
lines changed

3 files changed

+24
-22
lines changed

.github/workflows/build_image_pnpm.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,21 @@ jobs:
1515
steps:
1616
- uses: actions/checkout@v4
1717

18+
- name: Set up QEMU
19+
uses: docker/setup-qemu-action@v3
20+
with:
21+
platforms: amd64,arm64
22+
23+
- name: Set up Docker Buildx
24+
id: buildx
25+
uses: docker/setup-buildx-action@v3
26+
27+
- name: Login to Docker Hub
28+
uses: docker/login-action@v3
29+
with:
30+
username: ${{ env.DOCKER_USERNAME }}
31+
password: ${{ secrets.DOCKER_HUB_PAT }}
32+
1833
- name: Container Details
1934
id: container_detail
2035
run: |
@@ -33,21 +48,6 @@ jobs:
3348
echo "imageName=${IMAGE_NAME}" >> $GITHUB_OUTPUT
3449
echo "suffix=${SUFFIX}" >> $GITHUB_OUTPUT
3550
36-
- name: Set up QEMU
37-
uses: docker/setup-qemu-action@v3
38-
with:
39-
platforms: amd64,arm64
40-
41-
- name: Set up Docker Buildx
42-
id: buildx
43-
uses: docker/setup-buildx-action@v3
44-
45-
- name: Login to Docker Hub
46-
uses: docker/login-action@v3
47-
with:
48-
username: ${{ env.DOCKER_USERNAME }}
49-
password: ${{ secrets.DOCKER_HUB_PAT }}
50-
5151
- name: Build node
5252
uses: docker/build-push-action@v5
5353
with:

Dockerfile.node-aws

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
## +aws: Building aws-cli
2-
# Even though alpine 3.18+ have native aws-cli package, the self-built package have lower size and ensure latest version.
3-
FROM python:3.12-alpine as builder
2+
# Even though alpine 3.18+ have native aws-cli package, the self-built package have lower size and ensure latest version, as well packaged as a proper standalone binary instead of installing multiple packages to global apk.
3+
FROM alpine as builder
44

5-
RUN apk add --update-cache --no-cache \
5+
RUN apk add --no-cache \
6+
python3 py3-pip \
7+
py3-ruamel.yaml \
68
unzip \
79
groff \
810
build-base \
@@ -15,15 +17,16 @@ WORKDIR /aws-cli
1517
RUN wget $(wget https://api.github.com/repos/aws/aws-cli/tags\?per_page\=1 -qO- | jq -r '.[0].tarball_url') -qO- | \
1618
tar -xz --strip-components=1 --exclude=.changes --exclude=.github --exclude=tests --exclude=proposals
1719

18-
RUN python -m venv venv
19-
RUN . venv/bin/activate
20+
RUN python -m pip config set global.break-system-packages true
21+
RUN sed -i '/self._build_aws_completer()/d' backends/build_system/exe.py
2022
RUN ./configure --with-download-deps --with-install-type=portable-exe --prefix=/opt/aws-cli
2123
RUN make
2224
RUN make install
2325

2426
# reduce image size: remove autocomplete and examples
2527
RUN rm -rf /opt/aws-cli/bin/aws_completer /opt/aws-cli/lib/aws-cli/aws_completer /opt/aws-cli/lib/aws-cli/awscli/data/ac.index /opt/aws-cli/lib/aws-cli/awscli/examples
2628
RUN find /opt/aws-cli/lib/aws-cli/awscli/data -name completions-1*.json -delete
29+
RUN find /opt/aws-cli/lib/aws-cli/awscli/botocore/data -name completions-1*.json -delete
2730
RUN find /opt/aws-cli/lib/aws-cli/awscli/botocore/data -name examples-1.json -delete
2831
##
2932

Dockerfile.node-aws-dev

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
## +aws: Building aws-cli
2-
# Even though alpine 3.18+ have native aws-cli package, the self-built package have lower size and ensure latest version.
1+
## +aws: Including aws-cli
32
FROM namesmt/images-alpine:node-aws as builder
43
##
54

0 commit comments

Comments
 (0)