mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 14:10:49 -05:00
* fix(compat): shim aws to inject --endpoint-url from AWS_ENDPOINT_URL, add CI smoke test * fix(compat): migrate to AWS CLI v2, drop the endpoint-url shim --------- Co-authored-by: doraemon2200 <106516578+doraemon2200@users.noreply.github.com>
67 lines
3.2 KiB
Docker
67 lines
3.2 KiB
Docker
ARG VERSION=latest
|
|
# This must be the UBI-based image produced by Dockerfile.native-package.
|
|
# Release and nightly tags use VERSION; reusable builds override BASE_IMAGE
|
|
# with the digest-qualified native image they just published.
|
|
ARG BASE_IMAGE=floci/floci:${VERSION}
|
|
FROM ${BASE_IMAGE}
|
|
|
|
LABEL org.opencontainers.image.title="Floci (compat)" \
|
|
org.opencontainers.image.description="Floci compatibility image with AWS CLI and boto3 pre-installed" \
|
|
org.opencontainers.image.url="https://floci.io" \
|
|
org.opencontainers.image.source="https://github.com/floci-io/floci" \
|
|
org.opencontainers.image.licenses="MIT" \
|
|
org.opencontainers.image.vendor="Floci"
|
|
|
|
ENV AWS_DEFAULT_REGION=us-east-1
|
|
ENV AWS_ACCESS_KEY_ID=test
|
|
ENV AWS_SECRET_ACCESS_KEY=test
|
|
ENV AWS_ENDPOINT_URL="http://localhost:4566"
|
|
ENV AWS_CONFIG_FILE=/etc/floci/aws/config
|
|
ENV AWS_PAGER=""
|
|
|
|
# AWS CLI v2. v1 (the only version pip3 install awscli can give you) resolves
|
|
# a fixed set of services (SQS, RDS, DocDB, Neptune, EMR, Health) through
|
|
# awscli/customizations/overridesslcommonname.py, which forces the real AWS
|
|
# endpoint whenever no --endpoint-url flag is passed on the command line —
|
|
# no environment variable, including AWS_ENDPOINT_URL and the per-service
|
|
# AWS_ENDPOINT_URL_<SERVICE> overrides, can redirect it (aws/aws-cli#8737).
|
|
# v2 has no equivalent override and resolves every service through the
|
|
# normal endpoint chain, so AWS_ENDPOINT_URL alone is sufficient.
|
|
#
|
|
# v1 also entered maintenance mode 2026-07-15 (EOL 2027-07-15), so this is
|
|
# needed regardless of the endpoint-resolution bug.
|
|
#
|
|
# cli_binary_format has no env var in v2 (its provider chain is config-file,
|
|
# then a base64 constant), so blob params default to base64 here, same as
|
|
# a v2 install against real AWS. A hook passing raw bytes (e.g.
|
|
# aws lambda invoke --payload) needs --cli-binary-format raw-in-base64-out.
|
|
ARG AWSCLI_VERSION=2.36.24
|
|
USER root
|
|
RUN microdnf install -y --nodocs python3 python3-pip unzip \
|
|
&& pip3 install --no-cache-dir boto3 \
|
|
&& case "$(uname -m)" in \
|
|
x86_64) arch=x86_64 ;; \
|
|
aarch64) arch=aarch64 ;; \
|
|
*) echo "unsupported arch: $(uname -m)" >&2; exit 1 ;; \
|
|
esac \
|
|
&& curl -fsSL "https://awscli.amazonaws.com/awscli-exe-linux-${arch}-${AWSCLI_VERSION}.zip" -o /tmp/awscliv2.zip \
|
|
&& unzip -q /tmp/awscliv2.zip -d /tmp \
|
|
&& /tmp/aws/install --bin-dir /usr/bin --install-dir /usr/local/aws-cli \
|
|
&& rm -rf /tmp/awscliv2.zip /tmp/aws \
|
|
&& microdnf remove -y unzip \
|
|
&& microdnf clean all \
|
|
&& rm -rf /root/.cache/pip
|
|
|
|
COPY bin/awslocal /usr/local/bin/awslocal
|
|
RUN chmod +x /usr/local/bin/awslocal
|
|
|
|
# Pre-create the init-hook directories so archive-based copies (Testcontainers
|
|
# withCopyFileToContainer / `docker cp`) can drop hooks straight into them.
|
|
# Docker's archive extract unpacks into an existing dir and never mkdir -p's the
|
|
# parents, so without these the copy fails. Mirrors LocalStack, which ships
|
|
# /etc/localstack/init. Owned by the runtime user (uid 1001, group root).
|
|
RUN mkdir -p /etc/localstack/init/boot.d /etc/localstack/init/start.d /etc/localstack/init/ready.d \
|
|
/etc/floci/init/boot.d /etc/floci/init/start.d /etc/floci/init/ready.d \
|
|
&& chown -R 1001:root /etc/localstack /etc/floci
|
|
|
|
USER 1001 |