mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-13 11:10:59 +00:00
Adding docker caching
This commit is contained in:
parent
8e5a5d17a8
commit
5cd5c7ccf1
31
Dockerfile
31
Dockerfile
|
@ -6,9 +6,34 @@ RUN yarn
|
||||||
RUN yarn build
|
RUN yarn build
|
||||||
|
|
||||||
FROM rust:1.33 as rust
|
FROM rust:1.33 as rust
|
||||||
COPY server /app/server
|
|
||||||
|
# create a new empty shell project
|
||||||
|
WORKDIR /app
|
||||||
|
RUN USER=root cargo new server
|
||||||
WORKDIR /app/server
|
WORKDIR /app/server
|
||||||
|
|
||||||
|
# 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
|
||||||
|
RUN cargo build --release --bin lemmy
|
||||||
|
RUN ls ./target/release/.fingerprint/
|
||||||
|
RUN rm -r ./target/release/.fingerprint/server-*
|
||||||
|
|
||||||
|
# copy your source tree
|
||||||
|
# RUN rm -rf ./src/
|
||||||
|
COPY server/src ./src/
|
||||||
|
COPY server/migrations ./migrations/
|
||||||
|
|
||||||
|
# build for release
|
||||||
|
RUN cargo build --frozen --release --bin lemmy
|
||||||
|
RUN mv /app/server/target/release/lemmy /app/lemmy
|
||||||
|
|
||||||
|
# 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
|
||||||
COPY --from=node /app/ui/dist /app/dist
|
COPY --from=node /app/ui/dist /app/dist
|
||||||
RUN cargo build --release
|
|
||||||
RUN mv /app/server/target/release/lemmy /app/
|
|
||||||
EXPOSE 8536
|
EXPOSE 8536
|
||||||
|
|
|
@ -11,7 +11,7 @@ const transformInferno = require('ts-transform-inferno').default;
|
||||||
const transformClasscat = require('ts-transform-classcat').default;
|
const transformClasscat = require('ts-transform-classcat').default;
|
||||||
let fuse, app;
|
let fuse, app;
|
||||||
let isProduction = false;
|
let isProduction = false;
|
||||||
var setVersion = require('./set_version.js').setVersion;
|
// var setVersion = require('./set_version.js').setVersion;
|
||||||
|
|
||||||
Sparky.task('config', _ => {
|
Sparky.task('config', _ => {
|
||||||
fuse = new FuseBox({
|
fuse = new FuseBox({
|
||||||
|
@ -42,7 +42,7 @@ Sparky.task('config', _ => {
|
||||||
});
|
});
|
||||||
app = fuse.bundle('app').instructions('>index.tsx');
|
app = fuse.bundle('app').instructions('>index.tsx');
|
||||||
});
|
});
|
||||||
Sparky.task('version', _ => setVersion());
|
// Sparky.task('version', _ => setVersion());
|
||||||
Sparky.task('clean', _ => Sparky.src('dist/').clean('dist/'));
|
Sparky.task('clean', _ => Sparky.src('dist/').clean('dist/'));
|
||||||
Sparky.task('env', _ => (isProduction = true));
|
Sparky.task('env', _ => (isProduction = true));
|
||||||
Sparky.task('copy-assets', () => Sparky.src('assets/*.svg').dest('dist/'));
|
Sparky.task('copy-assets', () => Sparky.src('assets/*.svg').dest('dist/'));
|
||||||
|
|
2
ui/set_version.js
Normal file → Executable file
2
ui/set_version.js
Normal file → Executable file
|
@ -7,3 +7,5 @@ exports.setVersion = function() {
|
||||||
let line = `export let version: string = "${revision}";`;
|
let line = `export let version: string = "${revision}";`;
|
||||||
fs.writeFileSync("./src/version.ts", line);
|
fs.writeFileSync("./src/version.ts", line);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.setVersion()
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
export let version: string = "v0.0.2-0-gdae6651";
|
export let version: string = "v0.0.2-9-g8e5a5d1";
|
Loading…
Reference in a new issue