-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathDockerfile
26 lines (19 loc) · 857 Bytes
/
Dockerfile
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
FROM openjdk:8 as build-image
ARG SCRATCH_DIR=/var/task/build
WORKDIR /var/task
COPY src/ src/
COPY gradle/ gradle/
COPY build.gradle gradlew ./
RUN mkdir build
COPY gradle/lambda-build-init.gradle ./build
RUN echo $SCRATCH_DIR
RUN ./gradlew --project-cache-dir $SCRATCH_DIR/gradle-cache -Dsoftware.amazon.aws.lambdabuilders.scratch-dir=$SCRATCH_DIR --init-script $SCRATCH_DIR/lambda-build-init.gradle build
RUN rm -r $SCRATCH_DIR/gradle-cache
RUN rm -r $SCRATCH_DIR/lambda-build-init.gradle
RUN cp -r $SCRATCH_DIR/*/build/distributions/lambda-build/* .
FROM public.ecr.aws/lambda/java:8
COPY --from=build-image /var/task/META-INF ./
COPY --from=build-image /var/task/com ./com
COPY --from=build-image /var/task/lib/ ./lib
# Command can be overwritten by providing a different command in the template directly.
CMD ["com.example.App::handleRequest"]