-
Notifications
You must be signed in to change notification settings - Fork 530
Expand file tree
/
Copy pathsmartmodule.Dockerfile
More file actions
64 lines (51 loc) · 1.8 KB
/
smartmodule.Dockerfile
File metadata and controls
64 lines (51 loc) · 1.8 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
#
# This dockerfile creates a container of development dependencies for Fluvio smartmodules
# It configures a container, sets up an example smartmodule project, and builds the example
#
# to build:
# docker build -t sm-dev . -f smartmodule.Dockerfile
#
# to run: (opens a shall)
# docker run -it sm-dev
#
ARG ARCH=
FROM ${ARCH}ubuntu:22.04
RUN apt-get update -y
RUN apt-get install -y \
curl \
make \
gcc \
perl \
git
# add user
RUN useradd -ms /bin/bash smdevel
# optionally add sudo
# RUN apt-get install -y sudo
# RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
# RUN usermod -aG sudo smdevel
# optionally add vim
# RUN apt-get install -y vim
USER smdevel
ENV USER=smdevel
WORKDIR /home/smdevel
SHELL ["/usr/bin/bash", "-c"]
# setup rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
RUN source "$HOME/.cargo/env"
# setup fluvio
RUN curl -fsS https://raw.githubusercontent.com/fluvio-community/fluvio/master/install.sh | bash
# add Fluvio smartmodule deps
# source cargo/env is a little bit of a workaround
RUN source "$HOME/.cargo/env" && rustup target install wasm32-unknown-unknown
RUN source "$HOME/.cargo/env" && rustup target install wasm32-wasip1
RUN source "$HOME/.cargo/env" && cargo install cargo-generate
# create example-sm dir with a template project in it
# a user usually will run "cargo generate gh:infinyon/fluvio-smartmodule-template" and provide inputs
# here the script provides interactive parameters in tmpl-in
RUN echo '[values]' > tmpl-in
RUN echo 'smartmodule-type = "filter"' >> tmpl-in
RUN echo 'smartmodule-params = "true"' >> tmpl-in
RUN source "$HOME/.cargo/env" && \
cargo generate gh:infinyon/fluvio-smartmodule-template --name example-sm --template-values-file tmpl-in
RUN cd example-sm && source "$HOME/.cargo/env" && cargo build --release
CMD bash