diff --git a/docker-compose.yml b/docker-compose.yml index 3333ec4..f4e29fc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,7 +14,6 @@ services: backend: build: context: ./backend - dockerfile: Dockerfile container_name: backend environment: DATABASE_URL: postgres://postgres:password@postgres:5432/car_ledger_db @@ -27,12 +26,11 @@ services: frontend: build: context: ./frontend - dockerfile: Dockerfile + args: + BACKEND_URL: http://127.0.0.1:8081 container_name: frontend - environment: - BACKEND_URL: http://127.0.0.1:8081 ports: - - "8080:8080" + - "80:80" depends_on: - backend diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 73ff63e..0ddc3cb 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -1,11 +1,18 @@ FROM rust:1.82 AS builder WORKDIR /usr/src/app -COPY Cargo.toml Cargo.lock index.html ./ +COPY Cargo.toml Cargo.lock ./ COPY src ./src +COPY index.html ./ RUN cargo install trunk RUN rustup target add wasm32-unknown-unknown +ARG BACKEND_URL +RUN trunk build -EXPOSE 8080 -ENTRYPOINT ["trunk", "serve", "--address", "0.0.0.0"] \ No newline at end of file +FROM nginx:alpine +COPY --from=builder /usr/src/app/dist /usr/share/nginx/html + +EXPOSE 80 + +CMD ["nginx", "-g", "daemon off;"]