-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
43 lines (30 loc) · 1.01 KB
/
Dockerfile
File metadata and controls
43 lines (30 loc) · 1.01 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
# syntax=docker/dockerfile:1
# Step 1 : Create an image for building the Rust project
FROM rust:1.89 AS builder
# Install the build dependencies
RUN apt-get update && apt-get install -y build-essential
# Install wasm-pack
RUN cargo install wasm-pack
# Create a new directory for the project
WORKDIR /usr/src/app
# Copy the project files
COPY . .
# Build the project with wasm-pack
RUN wasm-pack build --release --target web
# Step 2 : Create an image for running the Python server
FROM python:3.13-slim
# Install python dependencies
COPY requirements.txt /app/requirements.txt
RUN pip install --upgrade pip && pip install --no-cache-dir -r /app/requirements.txt
# Copy the Python file, templates and static files
COPY ./app.py /app/app.py
COPY ./templates /app/templates
COPY ./static /app/static
# Copy the built files from the previous image
COPY --from=builder /usr/src/app/pkg /app/static/out
# Define the working directory
WORKDIR /app
# Expose the port 8000
EXPOSE 8000
# Run the Python server
CMD ["python", "app.py"]