mirror of https://github.com/w4/bin.git
use static linking in Dockerfile; add docker-compose.yml
This commit is contained in:
parent
793c2476af
commit
dc6f9b5ec6
12
Dockerfile
12
Dockerfile
|
@ -1,15 +1,17 @@
|
||||||
FROM rust:1-slim AS builder
|
FROM rust:1-slim AS builder
|
||||||
|
|
||||||
RUN apt update && apt install -y libclang-dev
|
RUN apt-get update && \
|
||||||
|
apt-get install -y libclang-dev musl-tools
|
||||||
|
RUN rustup target add x86_64-unknown-linux-musl
|
||||||
|
|
||||||
COPY . /sources
|
COPY . /sources
|
||||||
WORKDIR /sources
|
WORKDIR /sources
|
||||||
RUN cargo build --release
|
# force static linking with target to avoid glibc issues
|
||||||
RUN chown nobody:nogroup /sources/target/release/bin
|
RUN cargo build --release --target x86_64-unknown-linux-musl
|
||||||
|
RUN chown nobody:nogroup /sources/target/x86_64-unknown-linux-musl/release/bin
|
||||||
|
|
||||||
FROM debian:bullseye-slim
|
FROM debian:bullseye-slim
|
||||||
COPY --from=builder /sources/target/release/bin /pastebin
|
COPY --from=builder /sources/target/x86_64-unknown-linux-musl/release/bin /pastebin
|
||||||
|
|
||||||
USER nobody
|
USER nobody
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
version: '3'
|
||||||
|
services:
|
||||||
|
bin:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
ports:
|
||||||
|
- "8000:8000"
|
Loading…
Reference in New Issue