Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker Support #94

Merged
merged 2 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Dockerfile
28 changes: 28 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Build
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@patrickelectric I am not sure if you would like to have a separate build container for building or if you prefer it like this. let me know and I can adjust it.

FROM rust:alpine as builder
ARG TARGET_ARCH=x86_64-unknown-linux-musl

RUN apk add --no-cache musl-dev alpine-sdk
WORKDIR /usr/src/mavlink2rest
COPY . .

RUN rustup target add ${TARGET_ARCH}

RUN cargo build --release --target=${TARGET_ARCH}


# Runtime environment
FROM alpine
WORKDIR /root/

ARG TARGET_ARCH=x86_64-unknown-linux-musl

COPY --from=builder /usr/src/mavlink2rest/target/${TARGET_ARCH}/release/mavlink2rest ./mavlink2rest

ENV MAVLINK_SRC="udpin:127.0.0.1:14551"
ericjohnson97 marked this conversation as resolved.
Show resolved Hide resolved
ENV SERVER_PORT="0.0.0.0:8088"
ENV RUST_BACKTRACE=1

RUN chmod +x mavlink2rest

ENTRYPOINT ./mavlink2rest -c ${MAVLINK_SRC} -s ${SERVER_PORT}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add an env variable for generic arguments ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let me know what you think of the revised args

Loading