Add Dockerfile for deployment
This commit is contained in:
parent
4c73d191cf
commit
5e3ce8c406
2 changed files with 28 additions and 0 deletions
6
.dockerignore
Normal file
6
.dockerignore
Normal file
|
@ -0,0 +1,6 @@
|
|||
/.git
|
||||
/target
|
||||
/node_modules
|
||||
/dist
|
||||
/dist-ssr
|
||||
*.local
|
22
Dockerfile
Normal file
22
Dockerfile
Normal file
|
@ -0,0 +1,22 @@
|
|||
FROM ekidd/rust-musl-builder:1.51.0 as backend
|
||||
WORKDIR /home/rust/src
|
||||
COPY Cargo.toml Cargo.lock ./
|
||||
RUN mkdir src && echo "fn main() {}" > src/main.rs
|
||||
RUN cargo build --release
|
||||
COPY . .
|
||||
RUN sudo touch src/main.rs
|
||||
RUN cargo test --release
|
||||
RUN cargo build --release
|
||||
|
||||
FROM node:alpine as frontend
|
||||
WORKDIR /usr/src/app
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm ci
|
||||
COPY . .
|
||||
RUN npm run build
|
||||
|
||||
FROM scratch
|
||||
COPY --from=frontend /usr/src/app/dist dist
|
||||
COPY --from=backend /home/rust/src/target/x86_64-unknown-linux-musl/release/rustpad .
|
||||
USER 1000:1000
|
||||
CMD [ "./rustpad" ]
|
Loading…
Add table
Reference in a new issue