Skip to content

Commit 61c0c8b

Browse files
committed
refactor: remove bottlenck on slow builders
1 parent 91efb65 commit 61c0c8b

File tree

3 files changed

+60
-39
lines changed

3 files changed

+60
-39
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Build Installers
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
paths:
7+
- 'Dockerfile'
8+
- '.github/workflows/build-installers.yml'
9+
pull_request:
10+
branches: [ main ]
11+
paths:
12+
- 'Dockerfile'
13+
14+
jobs:
15+
build-installers:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Set up Docker Buildx
21+
uses: docker/setup-buildx-action@v3
22+
23+
- name: Login to GitHub Container Registry
24+
uses: docker/login-action@v3
25+
with:
26+
registry: ghcr.io
27+
username: ${{ github.actor }}
28+
password: ${{ secrets.GITHUB_TOKEN }}
29+
30+
- name: Build and push installers
31+
run: |
32+
# Build awscurl-installer
33+
docker buildx build \
34+
--platform linux/arm64 \
35+
--provenance=false \
36+
--target awscurl-installer \
37+
--tag ghcr.io/${{ github.repository_owner }}/lambda-shell-runtime:awscurl-installer \
38+
--push \
39+
-f - . << 'EOF'
40+
FROM public.ecr.aws/lambda/provided:al2023 AS awscurl-installer
41+
RUN dnf install -y unzip python3-pip findutils && dnf clean all
42+
RUN pip3 install --no-cache-dir --target /tmp/awscurl awscurl && \
43+
find /tmp/awscurl -type d -name '__pycache__' -exec rm -rf {} + && \
44+
find /tmp/awscurl -type f -name '*.pyc' -delete && \
45+
find /tmp/awscurl -type d -name '*.dist-info' -exec rm -rf {} +
46+
EOF
47+
48+
# Build awscli-installer
49+
docker buildx build \
50+
--platform linux/arm64 \
51+
--provenance=false \
52+
--target awscli-installer \
53+
--tag ghcr.io/${{ github.repository_owner }}/lambda-shell-runtime:awscli-installer \
54+
--push \
55+
-f - . << 'EOF'
56+
FROM public.ecr.aws/lambda/provided:al2023 AS awscli-installer
57+
RUN dnf install -y aws-cli && dnf clean all
58+
EOF

Dockerfile

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,7 @@ LABEL org.opencontainers.image.title="lambda-shell-runtime:tiny"
5555
LABEL org.opencontainers.image.version="${VERSION}"
5656
LABEL org.opencontainers.image.http_cli_version="${HTTP_CLI_VERSION}"
5757

58-
FROM public.ecr.aws/lambda/provided:al2023 AS awscurl-installer
5958

60-
RUN dnf install -y unzip python3-pip findutils && \
61-
dnf clean all
62-
63-
RUN pip3 install --no-cache-dir --target /tmp/awscurl awscurl && \
64-
find /tmp/awscurl -type d -name '__pycache__' -exec rm -rf {} + && \
65-
find /tmp/awscurl -type f -name '*.pyc' -delete && \
66-
find /tmp/awscurl -type d -name '*.dist-info' -exec rm -rf {} +
6759

6860
# micro: includes awscurl
6961
FROM ghcr.io/ql4b/lambda-shell-runtime:base AS micro-base
@@ -79,8 +71,7 @@ RUN dnf install -y python3 && \
7971
dnf clean all && \
8072
rm -rf /var/cache/dnf
8173

82-
COPY --from=awscurl-installer /tmp/awscurl /var/task/aws
83-
# Clean up Python cache and metadata
74+
COPY --from=ghcr.io/ql4b/lambda-shell-runtime:awscurl-installer /tmp/awscurl /var/task/aws
8475
RUN rm -rf \
8576
/var/task/aws/__pycache__ \
8677
/var/task/aws/*.dist-info \
@@ -106,10 +97,7 @@ FROM full-base AS full
10697
ARG VERSION
10798
ARG HTTP_CLI_VERSION
10899

109-
RUN dnf install -y \
110-
aws-cli && \
111-
dnf clean all && \
112-
rm -rf /var/cache/dnf
100+
COPY --from=ghcr.io/ql4b/lambda-shell-runtime:awscli-installer /usr/bin/aws /usr/bin/aws
113101

114102
LABEL org.opencontainers.image.title="lambda-shell-runtime:full"
115103
LABEL org.opencontainers.image.version="${VERSION}"

scripts/publish

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)