-
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 nightly Rust image, install Node.js a…
…nd dependencies, and adjust build commands for Tailwind CSS and Rust application
- Loading branch information
1 parent
e70f8c2
commit 58e037f
Showing
3 changed files
with
42 additions
and
19 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,21 +1,44 @@ | ||
# Use a Rust image with a compatible version | ||
FROM rust:1.73 | ||
ARG VARIANT="nightly-bookworm-slim" | ||
FROM rustlang/rust:${VARIANT} | ||
|
||
# Set the working directory | ||
WORKDIR /usr/src/myapp | ||
# Suppress interactive prompts in Docker builds | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
# Copy source code into the container | ||
COPY . . | ||
# Install required dependencies, including Node.js and OpenSSL | ||
RUN apt-get update && \ | ||
apt-get install -qq -y \ | ||
build-essential \ | ||
libwebkit2gtk-4.1-dev \ | ||
libgtk-3-dev \ | ||
libayatana-appindicator3-dev \ | ||
curl \ | ||
pkg-config \ | ||
libssl-dev && \ | ||
curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \ | ||
apt-get install -qq -y nodejs && \ | ||
npm install -g concurrently && \ | ||
apt-get clean | ||
|
||
# Set working directory | ||
WORKDIR /app | ||
|
||
# Install Node.js and npm for Tailwind CSS | ||
RUN apt-get update && apt-get install -y nodejs npm | ||
# Copy Node.js dependencies for TailwindCSS | ||
COPY package*.json ./ | ||
|
||
# Install Tailwind CSS and build the CSS file | ||
# Install Node.js dependencies | ||
RUN npm install | ||
RUN npx tailwindcss build -o dist/assets/styles/tailwind.css | ||
|
||
# Install dependencies and build the Rust application | ||
RUN cargo update && cargo build --release | ||
# Copy source files into the image | ||
COPY . . | ||
|
||
# Build TailwindCSS before building the Rust project | ||
RUN npm run build:css | ||
|
||
# Build the Rust project | ||
RUN cargo build --release | ||
|
||
# Expose the application port | ||
EXPOSE 8080 | ||
|
||
# Define the default command | ||
CMD ["./target/release/github_bio"] | ||
# Start the application | ||
CMD ["npm", "run", "serve"] |
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
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