chore: fix Dockerfile now that we have lib.rs
This commit is contained in:
15
Dockerfile
15
Dockerfile
@@ -6,9 +6,13 @@ WORKDIR /usr/src/pop_imap_importer
|
|||||||
# Copy manifests first to leverage Docker layer caching
|
# Copy manifests first to leverage Docker layer caching
|
||||||
COPY Cargo.* ./
|
COPY Cargo.* ./
|
||||||
|
|
||||||
# Create a dummy src/main.rs file to build dependencies
|
# Create dummy source files to build dependencies
|
||||||
RUN mkdir -p src && \
|
RUN mkdir -p src/bin && \
|
||||||
echo "fn main() {}" > src/main.rs
|
echo "fn main() {}" > src/main.rs && \
|
||||||
|
echo "" > src/lib.rs && \
|
||||||
|
echo "fn main() {}" > src/bin/normalize_imap.rs && \
|
||||||
|
echo "fn main() {}" > src/bin/fetch_email.rs && \
|
||||||
|
echo "fn main() {}" > src/bin/list_uids.rs
|
||||||
|
|
||||||
# Build dependencies only - this will be cached as long as Cargo.toml/Cargo.lock don't change
|
# Build dependencies only - this will be cached as long as Cargo.toml/Cargo.lock don't change
|
||||||
RUN --mount=type=cache,target=/usr/local/cargo/registry \
|
RUN --mount=type=cache,target=/usr/local/cargo/registry \
|
||||||
@@ -16,7 +20,8 @@ RUN --mount=type=cache,target=/usr/local/cargo/registry \
|
|||||||
|
|
||||||
# Copy the actual source code
|
# Copy the actual source code
|
||||||
COPY src src
|
COPY src src
|
||||||
RUN touch src/main.rs
|
# Touch source files to force rebuild
|
||||||
|
RUN touch src/main.rs src/lib.rs
|
||||||
|
|
||||||
# Build the actual application
|
# Build the actual application
|
||||||
RUN --mount=type=cache,target=/usr/local/cargo/registry \
|
RUN --mount=type=cache,target=/usr/local/cargo/registry \
|
||||||
@@ -32,7 +37,7 @@ RUN apt-get update && \
|
|||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# RUN apt-get update && apt-get install -y extra-runtime-dependencies && rm -rf /var/lib/apt/lists/*
|
# RUN apt-get update && apt-get install -y extra-runtime-dependencies && rm -rf /var/lib/apt/lists/*
|
||||||
COPY --from=builder /usr/src/pop_imap_importer/target/release/rs_pop_imap_importer /usr/local/bin/pop_imap_importer
|
COPY --from=builder /usr/src/pop_imap_importer/target/release/pop-to-imap /usr/local/bin/pop_imap_importer
|
||||||
|
|
||||||
CMD ["pop_imap_importer"]
|
CMD ["pop_imap_importer"]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user