Skip to content

Commit

Permalink
Merge pull request #57 from Dushyantbha012/main
Browse files Browse the repository at this point in the history
Containerizing the Frontend with Docker and Updating Documentation
  • Loading branch information
Pranav0-0Aggarwal authored Nov 17, 2024
2 parents 71144a0 + ebb6be0 commit 821fd41
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 0 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,20 @@ TAURI_SIGNING_PRIVATE_KEY_PASSWORD=pass
npm run tauri build
```

#### Running the Dockerfile

To build the Docker image, use the following command:
```bash
docker build --build-arg TAURI_SIGNING_PRIVATE_KEY=<private_key> --build-arg TAURI_SIGNING_PRIVATE_KEY_PASSWORD=<password> -t <image_name> .
```
Replace <private_key> and <password> with your actual Tauri signing private key and password and <image_name> with the image name. If you are using the default key, you can use the following command:

```bash
docker build --build-arg TAURI_SIGNING_PRIVATE_KEY=dW50cnVzdGVkIGNvbW1lbnQ6IHJzaWduIGVuY3J5cHRlZCBzZWNyZXQga2V5ClJXUlRZMEl5NlF2SjE3cWNXOVlQQ0JBTlNITEpOUVoyQ3ZuNTdOSkwyNE1NN2RmVWQ1a0FBQkFBQUFBQUFBQUFBQUlBQUFBQU9XOGpTSFNRd0Q4SjNSbm5Oc1E0OThIUGx6SS9lWXI3ZjJxN3BESEh1QTRiQXlkR2E5aG1oK1g0Tk5kcmFzc0IvZFZScEpubnptRkxlbDlUR2R1d1Y5OGRSYUVmUGoxNTFBcHpQZ1dSS2lHWklZVHNkV1Byd1VQSnZCdTZFWlVGOUFNVENBRlgweUU9Cg== --build-arg TAURI_SIGNING_PRIVATE_KEY_PASSWORD=pass -t <image_name> .
```
This command uses the preset private key and password.


### Python Backend Setup

#### Installation Steps
Expand Down
13 changes: 13 additions & 0 deletions docs/frontend/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,19 @@ This will create an optimized build of your application in the `src-tauri/target

Learn more about building Tauri apps in the [Tauri Building Guide](https://tauri.app/v1/guides/building/).

#### Running the Dockerfile

To build the Docker image, use the following command:
```bash
docker build --build-arg TAURI_SIGNING_PRIVATE_KEY=<private_key> --build-arg TAURI_SIGNING_PRIVATE_KEY_PASSWORD=<password> -t <image_name> .
```
Replace <private_key> and <password> with your actual Tauri signing private key and password and <image_name> with the image name. If you are using the default key, you can use the following command:

```bash
docker build --build-arg TAURI_SIGNING_PRIVATE_KEY=dW50cnVzdGVkIGNvbW1lbnQ6IHJzaWduIGVuY3J5cHRlZCBzZWNyZXQga2V5ClJXUlRZMEl5NlF2SjE3cWNXOVlQQ0JBTlNITEpOUVoyQ3ZuNTdOSkwyNE1NN2RmVWQ1a0FBQkFBQUFBQUFBQUFBQUlBQUFBQU9XOGpTSFNRd0Q4SjNSbm5Oc1E0OThIUGx6SS9lWXI3ZjJxN3BESEh1QTRiQXlkR2E5aG1oK1g0Tk5kcmFzc0IvZFZScEpubnptRkxlbDlUR2R1d1Y5OGRSYUVmUGoxNTFBcHpQZ1dSS2lHWklZVHNkV1Byd1VQSnZCdTZFWlVGOUFNVENBRlgweUU9Cg== --build-arg TAURI_SIGNING_PRIVATE_KEY_PASSWORD=pass -t <image_name> .
```
This command uses the preset private key and password.

## Troubleshooting

If you encounter any issues during setup or running the application:
Expand Down
58 changes: 58 additions & 0 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Use Ubuntu 22.04 as the base image
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 \
&& apt-get clean && rm -rf /var/lib/apt/lists/*

# Install Node.js (Node.js 16 is compatible with Tauri)
RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash - && \
apt-get install -y nodejs

# Install Rust
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"

# Install Tauri CLI
RUN npm install -g @tauri-apps/cli

# Define build arguments
ARG TAURI_SIGNING_PRIVATE_KEY
ARG TAURI_SIGNING_PRIVATE_KEY_PASSWORD

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

# Install dependencies
RUN npm install

# 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"]

0 comments on commit 821fd41

Please sign in to comment.