-
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 install Rust and Dioxus CLI, and add nece…
…ssary devDependencies
- Loading branch information
1 parent
515cf05
commit 752709e
Showing
1 changed file
with
17 additions
and
21 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,43 +1,39 @@ | ||
# syntax=docker/dockerfile:1 | ||
|
||
# Comments are provided throughout this file to help you get started. | ||
# If you need more help, visit the Dockerfile reference guide at | ||
# https://docs.docker.com/go/dockerfile-reference/ | ||
|
||
# Want to help us make this template better? Share your feedback here: https://forms.gle/ybq9Krt8jtBL3iCk7 | ||
|
||
ARG NODE_VERSION=23.0.0 | ||
|
||
FROM node:${NODE_VERSION}-alpine | ||
|
||
# Use production node environment by default. | ||
# Install Rust and Dioxus CLI for running `dx` commands | ||
RUN apk add --no-cache curl gcc musl-dev && \ | ||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \ | ||
source $HOME/.cargo/env && \ | ||
cargo install dioxus-cli | ||
|
||
# Use production node environment by default | ||
ENV NODE_ENV=production | ||
|
||
WORKDIR /usr/src/app | ||
|
||
# Copy package files into the image | ||
COPY package.json package-lock.json ./ | ||
|
||
# Install all dependencies | ||
# Install all dependencies (omit dev dependencies for production) | ||
RUN npm ci --omit=dev | ||
|
||
# Download dependencies as a separate step to take advantage of Docker's caching. | ||
# Leverage a cache mount to /root/.npm to speed up subsequent builds. | ||
# Leverage a bind mounts to package.json and package-lock.json to avoid having to copy them into | ||
# into this layer. | ||
RUN --mount=type=bind,source=package.json,target=package.json \ | ||
--mount=type=bind,source=package-lock.json,target=package-lock.json \ | ||
--mount=type=cache,target=/root/.npm \ | ||
npm ci --omit=dev | ||
# Install specific devDependencies needed for `serve` script | ||
RUN npm install concurrently tailwindcss --no-save | ||
|
||
# Create the `dist` directory with proper permissions | ||
RUN mkdir -p dist/assets/styles && chown -R node:node dist | ||
|
||
# Run the application as a non-root user. | ||
# Run the application as a non-root user | ||
USER node | ||
|
||
# Copy the rest of the source files into the image. | ||
# Copy the rest of the source files into the image | ||
COPY . . | ||
|
||
# Expose the port that the application listens on. | ||
# Expose the port that the application listens on | ||
EXPOSE 8080 | ||
|
||
# Run the application. | ||
# Run the application | ||
CMD ["npm", "run", "serve"] |