2024-01-13 14:24:14 +00:00
|
|
|
FROM --platform=$BUILDPLATFORM rust:1.75 as cross
|
2024-01-13 14:20:18 +00:00
|
|
|
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)
|
|
|
|
|
2024-01-13 14:22:13 +00:00
|
|
|
WORKDIR ./notes2ics
|
2024-01-13 14:20:18 +00:00
|
|
|
ADD . ./
|
|
|
|
RUN cargo build --release --target $(cat /.platform)
|
2024-01-13 14:22:13 +00:00
|
|
|
RUN cp ./target/$(cat /.platform)/release/notes2ics /notes2ics.bin # Get rid of this when build --out is stable
|
2024-01-13 14:20:18 +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}
|
|
|
|
|
2024-01-13 14:22:13 +00:00
|
|
|
COPY --from=cross /notes2ics.bin ${APP}/notes2ics
|
2024-01-13 14:20:18 +00:00
|
|
|
|
|
|
|
RUN chown -R $APP_USER:$APP_USER ${APP}
|
|
|
|
|
|
|
|
USER $APP_USER
|
|
|
|
WORKDIR ${APP}
|
|
|
|
|
2024-01-13 14:22:13 +00:00
|
|
|
CMD ["./notes2ics"]
|