40 lines
1.1 KiB
Docker
40 lines
1.1 KiB
Docker
|
FROM fedora:38 as build
|
||
|
ENV PKG_CONFIG_ALLOW_CROSS=1
|
||
|
|
||
|
RUN dnf install -y rust cargo ImageMagick-devel clang --setopt=install_weak_deps=False
|
||
|
|
||
|
ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse
|
||
|
|
||
|
WORKDIR /usr/src/liquid-rescale-api
|
||
|
|
||
|
# Download and compile deps
|
||
|
COPY Cargo.toml .
|
||
|
COPY Cargo.lock .
|
||
|
COPY docker_utils/dummy.rs .
|
||
|
# Change temporarely the path of the code
|
||
|
RUN sed -i 's|src/main.rs|dummy.rs|' Cargo.toml
|
||
|
# Build only deps
|
||
|
RUN cargo build --release
|
||
|
# Now return the file back to normal
|
||
|
RUN sed -i 's|dummy.rs|src/main.rs|' Cargo.toml
|
||
|
|
||
|
# Copy everything
|
||
|
COPY . .
|
||
|
# Add the wait script
|
||
|
ADD https://github.com/ufoscout/docker-compose-wait/releases/download/2.2.1/wait /wait
|
||
|
RUN chmod +x /wait
|
||
|
# Build our code
|
||
|
RUN cargo build --release
|
||
|
|
||
|
FROM fedora:38
|
||
|
|
||
|
RUN dnf install -y ImageMagick-devel --setopt=install_weak_deps=False \
|
||
|
&& dnf clean all \
|
||
|
&& rm -rf /var/cache/yum
|
||
|
|
||
|
COPY --from=build /usr/src/liquid-rescale-api/target/release/liquid-rescale-api /liquid-rescale-api/liquid-rescale-api
|
||
|
COPY --from=build /wait /wait
|
||
|
|
||
|
WORKDIR /liquid-rescale-api
|
||
|
|
||
|
CMD /wait && /liquid-rescale-api/liquid-rescale-api
|