From f8129e460a757a7084c81726cdb896553dd54854 Mon Sep 17 00:00:00 2001 From: Eric Date: Thu, 21 Nov 2024 15:38:32 -0800 Subject: [PATCH] chore: update Dockerfile to use custom Rust and Dioxus base image and streamline directory setup --- Dockerfile | 32 +++++++------------------------- 1 file changed, 7 insertions(+), 25 deletions(-) diff --git a/Dockerfile b/Dockerfile index ff85e2b..627a635 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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"] \ No newline at end of file