feat: new docker support
This commit is contained in:
parent
92525d6b68
commit
db07ed669b
@ -28,3 +28,4 @@ rand = "0.6.5"
|
||||
pretty_env_logger = "0.3.0"
|
||||
time = "0.1.42"
|
||||
rss = "1.7.0"
|
||||
diesel_derives = "1.4.0"
|
||||
|
16
Dockerfile
16
Dockerfile
@ -1,7 +1,4 @@
|
||||
FROM clux/muslrust:nightly as builder
|
||||
|
||||
RUN cargo install diesel_cli --no-default-features --features postgres
|
||||
RUN mkdir -p /out && cp /root/.cargo/bin/diesel /out/
|
||||
FROM clux/muslrust:stable as builder
|
||||
|
||||
COPY . /app
|
||||
WORKDIR /app
|
||||
@ -10,20 +7,13 @@ RUN cargo build --release
|
||||
|
||||
FROM alpine:latest
|
||||
|
||||
COPY --from=builder /out/diesel /bin/
|
||||
|
||||
COPY --from=builder /app/migrations /application/migrations
|
||||
COPY --from=builder /app/Rocket.toml /application/Rocket.toml
|
||||
COPY --from=builder /app/Cargo.toml /application/Cargo.toml
|
||||
COPY --from=builder /app/entrypoint.sh /application/entrypoint.sh
|
||||
COPY --from=builder /app/static /application/static
|
||||
COPY --from=builder /app/templates /application/templates
|
||||
COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/rubble /application/rubble
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
ENV ROCKET_ENV production
|
||||
ENV ROCKET_SECRET_KEY 123456
|
||||
ENV DATABASE_URL postgres://root@postgres/rubble
|
||||
|
||||
WORKDIR /application
|
||||
CMD ["sh", "./entrypoint.sh"]
|
||||
CMD ["./rubble"]
|
2
Procfile
2
Procfile
@ -1,2 +0,0 @@
|
||||
web: ROCKET_PORT=$PORT ROCKET_SECRET_KEY=$SECRET_KEY ./target/release/rubble
|
||||
release: ./target/release/diesel migration run
|
16
Rocket.toml
16
Rocket.toml
@ -1,16 +0,0 @@
|
||||
[global]
|
||||
template_dir = "static"
|
||||
|
||||
[development]
|
||||
address = "localhost"
|
||||
port = 8000
|
||||
workers = 1
|
||||
log = "normal"
|
||||
secret_key = "JR7bWcbwRfF/+Kc3jKfgxPiuLFyUxMRgTyJlcruItA0="
|
||||
limits = { forms = 524288 }
|
||||
|
||||
[production]
|
||||
address = "0.0.0.0"
|
||||
log = "critical"
|
||||
port = 8000
|
||||
limits = { forms = 524288 }
|
@ -1,2 +0,0 @@
|
||||
RUST_INSTALL_DIESEL=1
|
||||
DIESEL_FLAGS="--no-default-features --features postgres"
|
@ -1 +0,0 @@
|
||||
nightly
|
@ -1,8 +1,8 @@
|
||||
#![feature(proc_macro_hygiene, decl_macro, custom_attribute, plugin)]
|
||||
|
||||
#[macro_use]
|
||||
extern crate diesel;
|
||||
#[macro_use]
|
||||
extern crate diesel_derives;
|
||||
#[macro_use]
|
||||
extern crate diesel_migrations;
|
||||
|
||||
use actix_web::{
|
||||
|
@ -10,7 +10,6 @@ use diesel::{Insertable, Queryable};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Queryable, Debug, Serialize)]
|
||||
#[table_name = "articles"]
|
||||
pub struct Article {
|
||||
pub id: i32,
|
||||
pub title: String,
|
||||
|
Loading…
Reference in New Issue
Block a user