2024-09-18 10:32:42 +00:00
|
|
|
FROM docker.io/rust:1-alpine3.20 AS builder
|
|
|
|
|
|
|
|
RUN mkdir /db
|
|
|
|
RUN echo "tasker:x:2222:2222:Linux User,,,:/:/app" > /passwd
|
|
|
|
|
|
|
|
RUN apk --no-cache add \
|
|
|
|
musl-dev \
|
|
|
|
git
|
|
|
|
|
|
|
|
ENV CARGO_CARGO_NEW_VCS="none"
|
|
|
|
ENV CARGO_BUILD_RUSTFLAGS="-C target-feature=+crt-static"
|
|
|
|
|
|
|
|
ENV VERSION=af918bdf0dea7f7b6e920680c947fc37b37ffffb
|
|
|
|
RUN git clone https://github.com/GothenburgBitFactory/taskchampion-sync-server.git /work
|
|
|
|
WORKDIR /work
|
|
|
|
RUN git checkout "$VERSION"
|
2024-09-19 06:30:30 +00:00
|
|
|
RUN sed -i 's/format!("0.0.0.0:{}", port)/"[::]:8080"/g' src/bin/taskchampion-sync-server.rs
|
2024-09-18 10:32:42 +00:00
|
|
|
|
|
|
|
RUN cargo build --release --target=$(arch)-unknown-linux-musl
|
|
|
|
RUN cp "./target/$(arch)-unknown-linux-musl/release/taskchampion-sync-server" /app
|
|
|
|
|
|
|
|
FROM scratch
|
|
|
|
|
|
|
|
COPY --from=builder /passwd /etc/passwd
|
|
|
|
COPY --from=builder /app /app
|
|
|
|
COPY --from=builder --chown=2222: /db /db
|
|
|
|
|
|
|
|
USER tasker
|
|
|
|
|
|
|
|
ENTRYPOINT ["/app", "--data-dir", "/db", "--port", "8080"]
|
|
|
|
EXPOSE 8080
|
|
|
|
VOLUME ["/db"]
|