2024-01-11 16:42:58 -05:00
# To build the docker image, run the following command from the shell. This Dockerfile
# is configured to be run from within the cpp directory of aws-doc-sdk-examples.
2023-03-01 15:59:42 -05:00
#
2024-01-11 16:42:58 -05:00
# 'docker build -t <container_tag> .'
2023-03-01 15:59:42 -05:00
#
# The following command will run the docker image, copying your AWS credentials.
2023-07-14 11:44:32 -04:00
# 'docker run -it --volume ~/.aws/credentials:/home/tests/.aws/credentials <container_tag>'
2023-03-01 15:59:42 -05:00
2023-07-07 06:46:47 -07:00
FROM public.ecr.aws/amazonlinux/amazonlinux:2023
2023-03-01 15:59:42 -05:00
# Set up the dependencies.
RUN \
2023-07-14 11:44:32 -04:00
dnf --setopt= install_weak_deps = False -y install gcc gcc-c++ make cmake libcurl-devel openssl-devel libuuid-devel pulseaudio-libs-devel git libzip-tools libzip-devel && \
2023-07-07 06:46:47 -07:00
dnf clean all
2023-03-01 15:59:42 -05:00
# Build only the services needed for example code.
ENV SERVICES = "acm;autoscaling;cloudtrail;codebuild;codecommit;cognito-idp;dynamodb;ec2;elasticache;elasticbeanstalk"
2024-03-04 19:40:50 -05:00
ENV SERVICES = ${ SERVICES } ";elasticfilesystem;email;events;glacier;glue;guardduty;iam;iot;iot-data;kinesis;lambda;logs;mediaconvert;medical-imaging;monitoring"
2023-07-14 11:44:32 -04:00
ENV SERVICES = ${ SERVICES } ";monitoring;neptune;rds;rds-data;redshift;rekognition;s3;s3-crt;s3-encryption;secretsmanager;sesv2;sns;sqs"
2023-03-01 15:59:42 -05:00
ENV SERVICES = ${ SERVICES } ";storagegateway;sts;transfer;transcribe;transcribestreaming"
# Build aws-sdk-cpp, building only the modules listed in SERVICES using the BUILD_ONLY argument.
RUN \
cd /usr/local && \
git clone --recurse-submodules https://github.com/aws/aws-sdk-cpp.git && \
cd aws-sdk-cpp && \
mkdir -p build && \
cd build && \
cmake -DCMAKE_BUILD_TYPE= Debug -DBUILD_ONLY= ${ SERVICES } -DENABLE_TESTING= ON .. && \
2023-07-07 06:46:47 -07:00
make --jobs= $( nproc) install && \
2023-03-01 15:59:42 -05:00
cd /usr/local
# Install googletest.
RUN \
git clone https://github.com/google/googletest.git -b v1.13.0 && \
cd googletest && \
mkdir build && \
2023-02-09 13:07:30 -05:00
cd build && \
2023-03-01 15:59:42 -05:00
cmake .. -DBUILD_GMOCK= OFF && \
2023-07-07 06:46:47 -07:00
make -j$( nproc) && \
2023-02-09 13:07:30 -05:00
make install
2023-05-03 12:47:16 -04:00
2023-03-01 15:59:42 -05:00
# Copy the C++ example code.
RUN mkdir -p /src/cpp
2023-05-03 12:47:16 -04:00
2023-10-03 15:36:27 -04:00
COPY . /src/cpp/
2023-03-01 15:59:42 -05:00
2023-10-03 15:36:27 -04:00
# Commented until https://github.com/awsdocs/aws-doc-sdk-examples/issues/5454 resolved.
## The sample files are needed for some of the automated tests.
#RUN mkdir -p /src/resources/sample_files
#COPY resources/sample_files /src/resources/sample_files
2023-03-01 15:59:42 -05:00
WORKDIR /src/cpp /
2023-02-09 13:07:30 -05:00
2023-05-03 12:47:16 -04:00
RUN useradd -ms /bin/bash tests && \
2024-02-06 16:04:40 -05:00
chown -R tests /src/cpp
2023-05-03 12:47:16 -04:00
USER tests
2023-11-08 16:05:41 -05:00
CMD [ "python3" , "/src/cpp/run_automated_tests.py" , "-23" ]