ics-adapter/Dockerfile

45 lines
1.1 KiB
Text
Raw Normal View History

2023-08-06 12:15:41 +00:00
FROM --platform=$BUILDPLATFORM rust:1.70 as cross
ARG TARGETARCH
COPY docker/platform.sh .
RUN ./platform.sh # should write /.platform and /.compiler
RUN rustup target add $(cat /.platform)
RUN apt update && apt-get install -y unzip $(cat /.compiler)
2023-06-13 18:53:58 +00:00
RUN USER=root cargo new --bin ics-adapter
WORKDIR ./ics-adapter
COPY ./Cargo.toml ./Cargo.toml
2023-08-06 12:15:41 +00:00
RUN cargo build --release --target $(cat /.platform)
2023-06-13 18:53:58 +00:00
RUN rm src/*.rs
ADD . ./
2023-06-13 18:58:25 +00:00
RUN rm ./target/release/deps/ics_adapter*
2023-08-06 12:15:41 +00:00
RUN cargo build --release --target $(cat /.platform)
RUN cp /usr/src/trow/target/$(cat /.platform)/release/ics-adapter /ics-adapter.bin # Get rid of this when build --out is stable
2023-06-13 18:53:58 +00:00
FROM debian:buster-slim
ARG APP=/usr/src/app
RUN apt-get update \
&& apt-get install -y ca-certificates tzdata \
&& rm -rf /var/lib/apt/lists/*
EXPOSE 3000
ENV TZ=Etc/UTC \
APP_USER=appuser
RUN groupadd $APP_USER \
&& useradd -g $APP_USER $APP_USER \
&& mkdir -p ${APP}
2023-08-06 12:15:41 +00:00
COPY --from=cross /ics-adapter.bin ${APP}/ics-adapter
2023-06-13 18:53:58 +00:00
RUN chown -R $APP_USER:$APP_USER ${APP}
USER $APP_USER
WORKDIR ${APP}
CMD ["./ics-adapter"]