2
0
Fork 0
mirror of https://git.asonix.dog/asonix/pict-rs synced 2024-12-22 19:31:35 +00:00
pict-rs/docker/dev/Dockerfile

31 lines
765 B
Text
Raw Normal View History

2020-06-07 20:21:25 +00:00
# Build
FROM ekidd/rust-musl-builder:1.44.0 as rust
2020-06-07 20:21:25 +00:00
# Cache deps
WORKDIR /app
RUN sudo chown -R rust:rust .
RUN USER=root cargo new server
WORKDIR /app/server
COPY Cargo.toml Cargo.lock ./
RUN sudo chown -R rust:rust .
RUN mkdir -p ./src/bin \
&& echo 'fn main() { println!("Dummy") }' > ./src/bin/main.rs
RUN cargo build --release
RUN rm -f ./target/x86_64-unknown-linux-musl/release/deps/pict_rs*
COPY src ./src/
# Build for release
RUN cargo build --frozen --release
FROM alpine:3.11
2020-06-07 20:21:25 +00:00
# Copy resources
COPY --from=rust /app/server/target/x86_64-unknown-linux-musl/release/pict-rs /app/pict-rs
RUN addgroup -g 1000 pictrs
RUN adduser -D -s /bin/sh -u 1000 -G pictrs pictrs
RUN chown pictrs:pictrs /app/pict-rs
USER pictrs
EXPOSE 8080
CMD ["/app/pict-rs"]