COPY . .
# Build the project
-RUN echo "pub const VERSION: &str = \"$(git describe --tag)\";" > "crates/utils/src/version.rs"
# Debug mode build
RUN --mount=type=cache,target=/app/target \
if [ "$RUST_RELEASE_MODE" = "debug" ] ; then \
- cargo build --target ${CARGO_BUILD_TARGET} \
+ echo "pub const VERSION: &str = \"$(git describe --tag)\";" > "crates/utils/src/version.rs" \
+ && cargo build --target ${CARGO_BUILD_TARGET} \
&& cp ./target/$CARGO_BUILD_TARGET/$RUST_RELEASE_MODE/lemmy_server /app/lemmy_server; \
fi
# Release mode build
RUN \
if [ "$RUST_RELEASE_MODE" = "release" ] ; then \
- cargo build --target ${CARGO_BUILD_TARGET} --release \
+ echo "pub const VERSION: &str = \"$(git describe --tag)\";" > "crates/utils/src/version.rs" \
+ && cargo build --target ${CARGO_BUILD_TARGET} --release \
&& cp ./target/$CARGO_BUILD_TARGET/$RUST_RELEASE_MODE/lemmy_server /app/lemmy_server; \
fi
# Copy resources
COPY --from=builder /app/lemmy_server /app/lemmy
-EXPOSE 8536
CMD ["/app/lemmy"]