Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reducing cotainer size and add layer for optimize building for frontend #72

Merged
merged 3 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions frontend/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Ignore node_modules
node_modules/
# Ignore generated files
/dist
/src-tauri/target/
/src-tauri/gen/schemas
# Ignore Git files
.git/
.gitignore
50 changes: 22 additions & 28 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@ FROM ubuntu:22.04
# Install dependencies
RUN apt-get update && \
apt-get install -y \
curl \
build-essential \
libgtk-3-dev \
libwebkit2gtk-4.0-dev \
libappindicator3-dev \
wget \
xz-utils \
libssl-dev \
libglib2.0-dev \
libgirepository1.0-dev \
pkg-config \
software-properties-common \
libjavascriptcoregtk-4.0-dev \
libjavascriptcoregtk-4.1-dev \
libsoup-3.0-dev \
libwebkit2gtk-4.1-dev \
librsvg2-dev \
file \
curl \
build-essential \
libgtk-3-dev \
libwebkit2gtk-4.0-dev \
libappindicator3-dev \
wget \
xz-utils \
libssl-dev \
libglib2.0-dev \
libgirepository1.0-dev \
pkg-config \
software-properties-common \
libjavascriptcoregtk-4.0-dev \
libjavascriptcoregtk-4.1-dev \
libsoup-3.0-dev \
libwebkit2gtk-4.1-dev \
librsvg2-dev \
file \
&& apt-get clean && rm -rf /var/lib/apt/lists/*

# Install Node.js (Node.js 16 is compatible with Tauri)
Expand All @@ -41,20 +41,14 @@ ARG TAURI_SIGNING_PRIVATE_KEY_PASSWORD

# Copy the application source code to the container
WORKDIR /app
COPY . .

# Copy the package.json file
COPY package.json .
# Install dependencies
RUN npm install

# Copy the rest of the code
COPY . .
# Set environment variables using build arguments
ENV TAURI_SIGNING_PRIVATE_KEY=$TAURI_SIGNING_PRIVATE_KEY
ENV TAURI_SIGNING_PRIVATE_KEY_PASSWORD=$TAURI_SIGNING_PRIVATE_KEY_PASSWORD

# Build the frontend (React app)
RUN npm run build

# Build the Tauri application
RUN npm run tauri build -v

# Set the container's entrypoint to access the bundled files
CMD ["bash"]