diff --git a/Dockerfile b/Dockerfile index 343506b..064bdb9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,10 @@ ##### Builder #### -FROM rust:1.62-slim-bullseye as builder +FROM rust:1.64-alpine as builder -RUN apt-get update && apt-get -y upgrade -RUN apt-get -y install --no-install-recommends sqlite3 libsqlite3-dev npm && rm -rf /var/lib/apt/lists/* +RUN apk add --no-cache sqlite npm musl-dev + +# Install Typescript +RUN npm install -g typescript WORKDIR /usr/src @@ -18,9 +20,6 @@ WORKDIR /usr/src/huellas # This is an empty build to get the dependencies cached. RUN cargo build --release -# Install Typescript -RUN npm install -g typescript - # Now copy in the rest of the sources COPY src /usr/src/huellas/src/ COPY migrations /usr/src/huellas/migrations/ @@ -45,12 +44,15 @@ RUN npm install # Transpile RUN tsc +# Delete the first line of jvascript ts-client +RUN sed -i '1d' build/client.js + ################ ##### Runtime -FROM debian:bullseye-slim AS runtime +FROM alpine:3.16 AS Runtime + +RUN apk add --no-cache sqlite -RUN apt-get update && apt-get -y upgrade -RUN apt-get -y install --no-install-recommends sqlite3 && rm -rf /var/lib/apt/lists/* # Copy application binary from builder image COPY --from=builder /usr/src/huellas/target/release/huellas /usr/local/bin # Copy Rocket.toml @@ -60,8 +62,6 @@ COPY Rocket.toml /usr/local/bin COPY static /usr/local/bin/static/ # Copy javascript client COPY --from=builder /usr/src/huellas/ts-client/build/client.js /usr/local/bin/static -# Delete the first line of jvascript ts-client -RUN sed -i '1d' /usr/local/bin/static/client.js # Run the application WORKDIR /usr/local/bin