WillSquire / docker-diesel-cli

Minimalistic Diesel CLI container.
7 stars 0 forks source link

Improve the container #1

Closed williamdes closed 3 years ago

williamdes commented 3 years ago

Here is my examples for a mysql container

FROM rustlang/rust:nightly-alpine as diesel-build

RUN apk add --no-cache --update mariadb-connector-c-dev musl-dev
RUN RUSTFLAGS="-C target-feature=-crt-static" cargo install diesel_cli --no-default-features --features mysql
FROM alpine:3.12 as runtime
# https://github.com/mischov/meeseeks/issues/98#issuecomment-636615680
RUN apk add --no-cache --update mariadb-connector-c libgcc

WORKDIR /app
COPY /migrations /app/migrations
COPY /docker/docker-entrypoint.sh /docker-entrypoint.sh

COPY --from=diesel-build /usr/local/cargo/bin/diesel /usr/local/bin
COPY --from=builder /workspace/target/release/example-api /usr/local/bin

ENTRYPOINT ["/docker-entrypoint.sh"]
#!/bin/sh -eu

printf 'Running in: %s\n' "$PWD"
printf '> Listing migrations status...\n'
diesel migration list --migration-dir /app/migrations
printf '> Running migrations...\n'
diesel migration run --migration-dir /app/migrations
printf '> Launching...\n'
example-api
WillSquire commented 3 years ago

Hi @williamdes,

Thanks for the comment. What exactly are the feature/s that you're looking for or better yet the problem to solve?

williamdes commented 3 years ago

Hi @WillSquire

The improvement is using alpine to have the smallest image possible

williamdes commented 3 years ago

I tried yesterday and nightly is not needed, so the base rust image can be used, with alpine to build the cli