forked from scala-lms/tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile_deploy
50 lines (35 loc) · 1.59 KB
/
Dockerfile_deploy
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
# get compiled assembly
FROM christianmoesl/wasmdb-backend as backend
# build wasm tools for AWS lambda
FROM amazonlinux:2 as wasm-tool-builder
RUN yum -y groupinstall "Development Tools" \
&& yum -y install wget file clang \
&& yum -y remove cmake
RUN wget https://cmake.org/files/v3.19/cmake-3.19.6.tar.gz \
&& tar -xvzf cmake-3.19.6.tar.gz \
&& cd cmake-3.19.6 \
&& export CC=gcc \
&& export CXX=g++ \
&& ./bootstrap -- -DCMAKE_USE_OPENSSL=OFF \
&& make \
&& make install \
&& ln -s /usr/local/bin/cmake /usr/bin/cmake
RUN git clone https://github.com/WebAssembly/wabt \
&& cd wabt \
&& git checkout tags/1.0.21 \
&& git submodule update --init \
&& make clang-release-no-tests \
&& mv /wabt/out/clang/Release/no-tests/wat2wasm /usr/bin/wat2wasm \
&& rm -rf /wabt /cmake-3.10.0
FROM ubuntu:latest
RUN DEBIAN_FRONTEND=noninteractive ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime \
&& apt-get update \
&& apt-get install -yq python3 python3-pip zip groff
RUN pip3 install awscli --upgrade --user
COPY --from=backend /opt/wasmdb-backend/target/scala-2.12/wasmdb-backend-assembly-0.1.0-SNAPSHOT.jar /opt/wasmdb-backend/assembly.jar
WORKDIR /opt/wasmdb-backend
RUN unzip assembly.jar -d assembly && rm assembly.jar
COPY --from=wasm-tool-builder /usr/bin/wat2wasm /opt/wasmdb-backend/assembly/wat2wasm
RUN cd assembly && zip -r ../assembly.zip *
#RUN zip assembly.zip /opt/wasmdb-backend/assembly
CMD python3 -m awscli s3 cp assembly.zip s3://wasmdb/assembly.zip && python3 -m awscli lambda update-function-code --function-name wasmdb --s3-bucket wasmdb --s3-key assembly.zip