-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
executable file
·38 lines (25 loc) · 901 Bytes
/
Dockerfile
File metadata and controls
executable file
·38 lines (25 loc) · 901 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
FROM rust:latest AS builder
ARG APP_NAME=uploader
ENV APP_NAME=${APP_NAME}
WORKDIR /app
RUN apt-get update -y && apt-get upgrade -y && apt-get install musl-tools -y
COPY Cargo.toml Cargo.lock ./
RUN mkdir src/ && echo "fn main() {}" > src/main.rs
RUN rustup target add x86_64-unknown-linux-musl
RUN cargo build --release --target x86_64-unknown-linux-musl
COPY src src
RUN touch src/main.rs
RUN cargo build --release --target x86_64-unknown-linux-musl
RUN strip target/x86_64-unknown-linux-musl/release/$APP_NAME
FROM alpine:latest
ARG APP_NAME=uploader
ENV APP_NAME=${APP_NAME}
ENV ROCKET_PROFILE=release
USER 1000
WORKDIR /app
COPY --from=builder --chown=1000:1000 /app/target/x86_64-unknown-linux-musl/release/$APP_NAME .
COPY --chown=1000:1000 ./Rocket.toml /app/Rocket.toml
COPY --chown=1000:1000 ./config.json /app/config.json
COPY ./static/ /app/static
EXPOSE 8000
CMD ./$APP_NAME