2019-04-06 05:29:20 +00:00
|
|
|
FROM node:10-jessie as node
|
|
|
|
#If encounter Invalid cross-device error -run on host 'echo N | sudo tee /sys/module/overlay/parameters/metacopy'
|
2019-04-10 04:45:10 +00:00
|
|
|
WORKDIR /app/ui
|
2019-04-17 23:55:57 +00:00
|
|
|
|
|
|
|
COPY ui/package.json ui/yarn.lock ./
|
|
|
|
RUN yarn install --pure-lockfile # This caches your deps
|
|
|
|
COPY ui /app/ui
|
2019-04-10 04:45:10 +00:00
|
|
|
RUN yarn build
|
2019-04-06 05:29:20 +00:00
|
|
|
|
|
|
|
FROM rust:1.33 as rust
|
2019-04-10 18:10:57 +00:00
|
|
|
|
|
|
|
# create a new empty shell project
|
|
|
|
WORKDIR /app
|
|
|
|
RUN USER=root cargo new server
|
2019-04-09 22:33:49 +00:00
|
|
|
WORKDIR /app/server
|
2019-04-10 18:10:57 +00:00
|
|
|
|
|
|
|
# copy over your manifests
|
|
|
|
COPY server/Cargo.toml server/Cargo.lock ./
|
|
|
|
|
|
|
|
# this build step will cache your dependencies
|
|
|
|
RUN mkdir -p ./src/bin \
|
|
|
|
&& echo 'fn main() { println!("Dummy") }' > ./src/bin/main.rs
|
2019-05-05 17:00:17 +00:00
|
|
|
RUN cargo build --release
|
2019-05-03 01:34:21 +00:00
|
|
|
RUN rm -r ./target/release/.fingerprint/lemmy_server-*
|
2019-04-10 18:10:57 +00:00
|
|
|
|
|
|
|
# copy your source tree
|
|
|
|
# RUN rm -rf ./src/
|
|
|
|
COPY server/src ./src/
|
|
|
|
COPY server/migrations ./migrations/
|
|
|
|
|
|
|
|
# build for release
|
2019-05-05 17:00:17 +00:00
|
|
|
RUN cargo build --frozen --release
|
|
|
|
RUN mv /app/server/target/release/lemmy_server /app/lemmy
|
2019-04-10 18:10:57 +00:00
|
|
|
|
2019-04-21 23:37:54 +00:00
|
|
|
# Get diesel-cli on there just in case
|
2019-04-24 17:33:17 +00:00
|
|
|
# RUN cargo install diesel_cli --no-default-features --features postgres
|
2019-04-21 23:37:54 +00:00
|
|
|
|
2019-04-10 18:10:57 +00:00
|
|
|
# The output image
|
|
|
|
# FROM debian:stable-slim
|
|
|
|
# RUN apt-get -y update && apt-get install -y postgresql-client
|
|
|
|
# COPY --from=rust /app/server/target/release/lemmy /app/lemmy
|
2019-04-06 05:29:20 +00:00
|
|
|
COPY --from=node /app/ui/dist /app/dist
|
2019-04-06 23:48:54 +00:00
|
|
|
EXPOSE 8536
|