-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
68 lines (57 loc) · 2.17 KB
/
Dockerfile
File metadata and controls
68 lines (57 loc) · 2.17 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
FROM amazonlinux:latest AS base
#------------------------------------------------
# provided by docker
ARG TARGETOS TARGETARCH
ARG USER_HOME_DIR="/root"
#TODO to support multi-platform, multi-runtime, runtime versions etc
# can be python, go, node etc.
ARG RUNTIME="net"
#8 or 6 (tbi) ... 39 (for python), 20 (for node) (you name it, it is a TBI anyway)
ARG RUNTIMEVER="8"
#aspnetcore or dotnet (aspnetcore includes dotnet), have no idea if it applies to other runtimes
ARG SDK="aspnetcore"
#ENV TARGETPLATFORM=$TARGETPLATFORM
ENV TARGETARCH=$TARGETARCH
ENV TARGETOS=$TARGETOS
ENV USER_HOME_DIR=$USER_HOME_DIR
ENV RUNTIME=$RUNTIME
ENV RUNTIMEVER=$RUNTIMEVER
ENV SDK=$SDK
#------------------------------------------------
RUN dnf install -y tar gzip zip which unzip procps-ng vim findutils git wget awscli-2 alternatives
RUN mkdir -p /opt
RUN mkdir -p /var
RUN mkdir -p /var/task
FROM base AS sdk
RUN dnf install -y "dotnet-sdk-${RUNTIMEVER}.0" gcc-c++ gcc alternatives
ENV PATH="$PATH:${USER_HOME_DIR}/.dotnet/tools"
FROM sdk AS sam
WORKDIR ${USER_HOME_DIR}
#TODO: build pakcage name based on ARGs/ENV
RUN echo "HOSTTYPE: ${HOSTTYPE}"
RUN wget https://github.com/aws/aws-sam-cli/releases/latest/download/aws-sam-cli-linux-x86_64.zip
RUN unzip aws-sam-cli-linux-x86_64.zip -d ./sam-install
RUN ./sam-install/install
RUN rm -rf sam-install
RUN rm -f aws-sam-cli-linux*
ENV SAM_CLI_TELEMETRY=0
COPY ./.aws ${USER_HOME_DIR}/.aws
FROM sam AS src
COPY ./src ${USER_HOME_DIR}
RUN find ${USER_HOME_DIR} -type f -name "*.sh" -exec chmod +x {} \;
#Optional to have Visual Code help while on playground
#COPY ./.vscode-server ${USER_HOME_DIR}/.vscode-server
FROM src AS createlayer
RUN ${USER_HOME_DIR}/scripts/create_layer.sh
#DBG
#RUN ls -altr /root/output
FROM scratch AS copytohost
ARG USER_HOME_DIR="/root"
COPY --link --from=createlayer /root/output /bin
#COPY --link --from=src /root/.vscode-server /.vscode-server
FROM createlayer AS shell
COPY ./src/scripts/docker_entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker_entrypoint.sh
WORKDIR ${USER_HOME_DIR}
ENTRYPOINT [ "/usr/local/bin/docker_entrypoint.sh" ]
CMD ["/bin/bash"]