-
Notifications
You must be signed in to change notification settings - Fork 133
/
Dockerfile.main-debug-s3
42 lines (34 loc) · 1.67 KB
/
Dockerfile.main-debug-s3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
FROM amazon/aws-for-fluent-bit:main-debug-base
COPY ./scripts/dockerfiles/Dockerfile.main-debug-base /Dockerfile.2.main-debug-base
ENV S3_BUCKET ""
ENV S3_KEY_PREFIX issue
RUN yum install -y unzip zip curl gdb
WORKDIR /var/tmp
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-$(arch).zip" -o "awscliv2.zip"
RUN unzip awscliv2.zip
RUN ./aws/install
RUN rm awscliv2.zip
RUN yum remove unzip -y \
&& yum clean all \
&& rm -rf /var/cache/yum
# For build efficiency, copy in the Fluent Bit config file again at this stage
COPY fluent-bit.conf \
/fluent-bit/etc/
COPY ./scripts/core_uploader.sh /
RUN chmod +x /core_uploader.sh
# Run Fluent Bit from the cores-out folder and collect crash symbols
# Move symbols to /cores folder after processing
RUN mkdir /cores-out
WORKDIR /cores-out
# Only last CMD command will be executed, automatically replaces the original entrypoint
CMD echo "AWS for Fluent Bit Container Image Version `cat /AWS_FOR_FLUENT_BIT_VERSION` - Debug Image with S3 Core Uploader"; \
if [ "$S3_BUCKET" == "" ]; then \
echo "Note: Please set S3_BUCKET environment variable to your crash symbol upload destination S3 bucket"; \
fi; \
if [ "$S3_KEY_PREFIX" == "issue" ]; then \
echo "Note: Please set S3_KEY_PREFIX environment variable to a useful identifier - e.g. company name, team name, customer name"; \
fi; \
export RUN_ID=$(($RANDOM%99999))$(($RANDOM%99999))$(($RANDOM%99999)); \
echo "RUN_ID is set to $RUN_ID"; \
/fluent-bit/bin/fluent-bit -e /fluent-bit/firehose.so -e /fluent-bit/cloudwatch.so -e /fluent-bit/kinesis.so -c /fluent-bit/etc/fluent-bit.conf; \
/core_uploader.sh $S3_BUCKET $S3_KEY_PREFIX $RUN_ID