-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update Dockerfile to use custom Rust and Dioxus base image and…
… streamline directory setup
- Loading branch information
1 parent
8845666
commit f8129e4
Showing
1 changed file
with
7 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,24 @@ | ||
# syntax=docker/dockerfile:1 | ||
|
||
ARG NODE_VERSION=23.0.0 | ||
FROM node:${NODE_VERSION}-alpine | ||
|
||
# Install necessary system dependencies for Rust and Dioxus CLI | ||
RUN apk add --no-cache curl gcc musl-dev perl make | ||
FROM duel80003/rust-dioxus:latest | ||
|
||
# Install Rust and Dioxus CLI as root | ||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain stable && \ | ||
source $HOME/.cargo/env && \ | ||
PATH="$HOME/.cargo/bin:$PATH" && \ | ||
cargo install dioxus-cli --root /usr/local && \ | ||
chmod +x /usr/local/bin/dx | ||
|
||
# Update PATH to include Cargo bin directory | ||
ENV PATH="/root/.cargo/bin:/usr/local/bin:${PATH}" | ||
|
||
# Ensure all necessary directories are owned by `node` | ||
RUN mkdir -p /root/.cargo /root/.rustup dist/assets/styles target && \ | ||
chown -R node:node /root/.cargo /root/.rustup dist target /usr/src/app | ||
|
||
# Use production node environment by default | ||
ENV NODE_ENV=production | ||
|
||
# Set the working directory | ||
WORKDIR /usr/src/app | ||
|
||
# Copy package files into the image and install dependencies | ||
# Copy package.json and install dependencies | ||
COPY package.json package-lock.json ./ | ||
RUN npm ci --omit=dev && npm install concurrently tailwindcss --no-save | ||
|
||
# Switch to non-root user for running the application | ||
USER node | ||
|
||
# Copy the rest of the source files into the image | ||
COPY --chown=node:node . . | ||
# Copy the rest of the application code | ||
COPY . . | ||
|
||
# Expose the port that the application listens on | ||
# Expose the port for the application | ||
EXPOSE 8080 | ||
|
||
# Run the application | ||
CMD ["npm", "run", "serve"] | ||
CMD ["npm", "run", "serve"] |