-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathDockerfile
More file actions
65 lines (51 loc) · 1.83 KB
/
Copy pathDockerfile
File metadata and controls
65 lines (51 loc) · 1.83 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
FROM rust:1.90.0 as builder
WORKDIR /build
# install nodeJS for functions
ENV NVM_DIR /usr/local/nvm
ENV NODE_VERSION 18.19.0
RUN mkdir -p $NVM_DIR
RUN curl "https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh" | bash \
&& . $NVM_DIR/nvm.sh \
&& nvm install $NODE_VERSION \
&& nvm alias default $NODE_VERSION \
&& nvm use default
ENV NODE_PATH $NVM_DIR/v$NODE_VERSION/lib/node_modules
ENV PATH="${NVM_DIR}/versions/node/v${NODE_VERSION}/bin/:${PATH}"
RUN node --version
RUN curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
COPY . .
RUN npm ci --loglevel=info
RUN cd crates/frontend \
&& wasm-pack build --target=web --release --no-default-features --features=hydrate
# copying .wasm, .js and .css files to target/site directory
RUN mkdir -p target/site && mkdir -p target/site/pkg
RUN cd crates/frontend \
&& npx tailwindcss -i ./styles/tailwind.css -o ./pkg/style.css
RUN mv crates/frontend/pkg target/site/
RUN cp -a crates/frontend/assets/. target/site/
RUN cp .env.example target/.env
# building backend
RUN cargo build --release --features=ssr
RUN pwd
RUN ls -l target
FROM ubuntu:25.10 as runtime
RUN mkdir -p /app/crates/superposition
ENV NODE_VERSION=18.19.0
WORKDIR /app
ARG SOURCE_COMMIT
ARG SUPERPOSITION_VERSION
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libpq5 \
ca-certificates \
curl \
postgresql-common && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
COPY --from=builder /build/target/release/superposition /app/superposition
COPY --from=builder /build/Cargo.toml /app/Cargo.toml
COPY --from=builder /build/target/site /app/target/site
COPY --from=builder /build/workspace_template.sql /app/workspace_template.sql
ENV SUPERPOSITION_VERSION=$SUPERPOSITION_VERSION
ENV SOURCE_COMMIT=$SOURCE_COMMIT
CMD ["/app/superposition"]