-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
65 lines (47 loc) · 1.49 KB
/
Dockerfile
File metadata and controls
65 lines (47 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Use an official Node.js image as a base for building the front end
FROM node:18 as frontend-builder
# Set the working directory
WORKDIR /app
# Copy the package.json and package-lock.json files
COPY package.json package-lock.json ./
# Install front-end dependencies
RUN npm install
# Copy the rest of the front-end source code
COPY . .
# Build the front end
RUN npm run build
# Use an official Rust image as a base
FROM rust:latest as builder
# Install necessary dependencies
RUN apt-get update && apt-get install -y \
libwebkit2gtk-4.0-dev \
libsoup2.4-dev \
pkg-config \
build-essential
# Set the working directory
WORKDIR /app
# Copy the Cargo.toml and Cargo.lock files
COPY ./src-tauri/Cargo.toml ./src-tauri/Cargo.lock ./
# Create a dummy main.rs file to build the dependencies
RUN mkdir src-tauri/src -p
RUN echo "fn main() {}" > src-tauri/src/main.rs
# Build the dependencies
RUN cargo build --release
RUN rm -rf src-tauri/src
# Copy the source code
COPY . .
# Build the Tauri app
RUN cargo build --release
# Use a smaller base image for the final container
FROM ubuntu:22.04
# Install necessary dependencies for running the app
RUN apt-get update && apt-get install -y \
libwebkit2gtk-4.0-37 \
libgtk-3-0 \
libayatana-appindicator3-1 \
libx11-xcb1 \
&& rm -rf /var/lib/apt/lists/*
# Copy the built binary from the builder stage
COPY --from=builder /app/target/release/mapbuilder /usr/local/bin/mapbuilder
# Set the entrypoint to run the app
ENTRYPOINT ["mapbuilder"]