add docker setup
This commit is contained in:
19
Dockerfile
19
Dockerfile
@@ -1,9 +1,10 @@
|
|||||||
|
# build image
|
||||||
FROM rust:latest as build
|
FROM rust:latest as build
|
||||||
|
|
||||||
RUN rustup target add wasm32-unknown-unknown
|
RUN rustup target add wasm32-unknown-unknown
|
||||||
RUN cargo install trunk wasm-bindgen-cli
|
RUN cargo install trunk wasm-bindgen-cli
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y npm binaryen && npm install -g sass
|
RUN apt-get update && apt-get install -y npm binaryen libpq5 && npm install -g sass
|
||||||
|
|
||||||
WORKDIR /app/src
|
WORKDIR /app/src
|
||||||
COPY . .
|
COPY . .
|
||||||
@@ -11,11 +12,23 @@ COPY . .
|
|||||||
RUN cd frontend && trunk build --release
|
RUN cd frontend && trunk build --release
|
||||||
RUN cargo build --release
|
RUN cargo build --release
|
||||||
|
|
||||||
FROM gcr.io/distroless/cc-debian10
|
|
||||||
|
# production image
|
||||||
|
|
||||||
|
#FROM gcr.io/distroless/cc-debian10
|
||||||
|
#COPY --from=build /usr/lib/*/libpq.so.5 /app/lib/
|
||||||
|
#COPY --from=build /usr/lib/*/libgssapi_krb5.so.2 /app/lib/
|
||||||
|
#COPY --from=build /usr/lib/*/libldap_r-2.4.so.2 /app/lib/
|
||||||
|
#COPY --from=build /usr/lib/*/libkrb5.so.3 /app/lib/
|
||||||
|
#COPY --from=build /usr/lib/*/libk5crypto.so.3 /app/lib/
|
||||||
|
#COPY --from=build /usr/lib/*/libcom_err.* /app/lib/
|
||||||
|
#ENV LD_LIBRARY_PATH=/app/lib/
|
||||||
|
|
||||||
|
FROM ubuntu:latest
|
||||||
RUN apt-get update && apt-get install -y libpq5
|
RUN apt-get update && apt-get install -y libpq5
|
||||||
|
|
||||||
COPY --from=build /app/src/target/release/backend /app/backend
|
COPY --from=build /app/src/target/release/backend /app/backend
|
||||||
COPY --from=build /app/src/frontend/dist /app/dist
|
COPY --from=build /app/src/frontend/dist /app/dist
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
CMD ["./backend"]
|
CMD ["./backend"]
|
||||||
|
|||||||
@@ -4,23 +4,30 @@ services:
|
|||||||
|
|
||||||
db:
|
db:
|
||||||
image: postgres
|
image: postgres
|
||||||
#restart: always
|
restart: always
|
||||||
|
volumes:
|
||||||
|
- ./data:/var/lib/postgresql/data
|
||||||
ports:
|
ports:
|
||||||
- 5432:5432
|
- 5432:5432
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_USER: user
|
- POSTGRES_DB=diesel_demo
|
||||||
POSTGRES_PASSWORD: password
|
- POSTGRES_USER=user
|
||||||
|
- POSTGRES_PASSWORD=password
|
||||||
|
|
||||||
adminer:
|
adminer:
|
||||||
image: adminer
|
image: adminer
|
||||||
#restart: always
|
restart: always
|
||||||
ports:
|
ports:
|
||||||
- 3000:8080
|
- 3000:8080
|
||||||
|
|
||||||
# photos:
|
# photos:
|
||||||
# build: .
|
# build: .
|
||||||
# environment:
|
# environment:
|
||||||
# - DATABASE_URL="postgres://user:password@db/diesel_demo"
|
# - DATABASE_URL=postgres://user:password@db/diesel_demo
|
||||||
|
# restart: always
|
||||||
# ports:
|
# ports:
|
||||||
# - 8081:8081
|
# - 8081:8081
|
||||||
|
# depends_on:
|
||||||
|
# - db
|
||||||
|
# links:
|
||||||
|
# - db
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ impl Component for App {
|
|||||||
fn update(&mut self, msg: Self::Message) -> bool {
|
fn update(&mut self, msg: Self::Message) -> bool {
|
||||||
match msg {
|
match msg {
|
||||||
Msg::GetPictures => {
|
Msg::GetPictures => {
|
||||||
let request = Request::get("http://localhost/api/pictures/")
|
let request = Request::get("/api/pictures/")
|
||||||
.body(Nothing)
|
.body(Nothing)
|
||||||
.expect("Could not build that request");
|
.expect("Could not build that request");
|
||||||
let callback =
|
let callback =
|
||||||
|
|||||||
Reference in New Issue
Block a user