Skip to content

Commit

Permalink
dockerfile updated for bindgen agnostic
Browse files Browse the repository at this point in the history
  • Loading branch information
oceanbluesky committed Dec 6, 2024
1 parent bb2d0b3 commit aa0478b
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ RUN apt-get update && apt-get install -y \
libayatana-appindicator3-dev \
curl \
git \
# Clean up to reduce image size
jq \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

Expand All @@ -29,13 +29,18 @@ RUN cargo install dioxus-cli
# Set working directory
WORKDIR /app

# Copy Rust dependency files
COPY Cargo.toml Cargo.lock ./

# Install the correct wasm-bindgen-cli version by reading the dependency tree
RUN cargo metadata --format-version 1 \
| jq -r '.packages[] | select(.name == "wasm-bindgen") | .version' \
| xargs -I {} cargo install -f wasm-bindgen-cli --version {}

# Copy package files first to leverage Docker cache
COPY package.json ./
RUN npm install

# Copy Rust dependency files
COPY Cargo.toml Cargo.lock ./

# Create dummy src to build dependencies
RUN mkdir src && \
echo "fn main() {println!(\"dummy\")}" > src/main.rs && \
Expand All @@ -55,4 +60,4 @@ RUN mkdir -p dist/assets/styles
EXPOSE 8080

# Start using your existing npm script
CMD ["npm", "run", "serve"]
CMD ["npm", "run", "serve"]

0 comments on commit aa0478b

Please sign in to comment.