diff --git a/.dockeringnore b/.dockeringnore new file mode 100644 index 0000000..94af222 --- /dev/null +++ b/.dockeringnore @@ -0,0 +1,13 @@ +**/.idea/ +**/.venv/ +**/dist/ +**/target/ +**/node_modules/ +.git/ +npm-debug.log +.coverage +.coverage.* +.env +.env* +.aws +**/nginx.conf.example diff --git a/api-service/Dockerfile b/api-service/Dockerfile index b919402..f8c0a53 100644 --- a/api-service/Dockerfile +++ b/api-service/Dockerfile @@ -1,18 +1,20 @@ -FROM rust:1.83 AS builder +FROM rust:1.83-slim-bookworm AS builder LABEL authors="raven" -WORKDIR /usr/src/proto -COPY ./proto . - -WORKDIR /usr/src/utils -COPY ./utils . - RUN apt-get update \ && DEBIAN_FRONTEND=noninteractive \ apt-get install --no-install-recommends --assume-yes \ + pkg-config \ + libssl-dev \ protobuf-compiler \ && rm -rf /var/lib/apt/lists/* +WORKDIR /usr/src/utils +COPY ./utils . + +WORKDIR /usr/src/proto +COPY ./proto . + WORKDIR /usr/src/api-service COPY ./api-service . diff --git a/auth-service/Dockerfile b/auth-service/Dockerfile index fb402e2..c5ab789 100644 --- a/auth-service/Dockerfile +++ b/auth-service/Dockerfile @@ -1,17 +1,19 @@ -# Use Rust official image for building the application -FROM rust:1.83 AS builder +FROM rust:1.83-slim-bookworm AS builder LABEL authors="raven" -WORKDIR /usr/src/proto -COPY ./proto . - -WORKDIR /usr/src/utils -COPY ./utils . - RUN apt-get update \ && DEBIAN_FRONTEND=noninteractive \ apt-get install --no-install-recommends --assume-yes \ - protobuf-compiler + pkg-config \ + libssl-dev \ + protobuf-compiler \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /usr/src/utils +COPY ./utils . + +WORKDIR /usr/src/proto +COPY ./proto . # Set the working directory WORKDIR /usr/src/auth-service diff --git a/character-service/Dockerfile b/character-service/Dockerfile index e775f99..d29902f 100644 --- a/character-service/Dockerfile +++ b/character-service/Dockerfile @@ -1,16 +1,19 @@ -FROM rust:1.83 AS builder +FROM rust:1.83-slim-bookworm AS builder LABEL authors="raven" -WORKDIR /usr/src/proto -COPY ./proto . - -WORKDIR /usr/src/utils -COPY ./utils . - RUN apt-get update \ && DEBIAN_FRONTEND=noninteractive \ apt-get install --no-install-recommends --assume-yes \ - protobuf-compiler + pkg-config \ + libssl-dev \ + protobuf-compiler \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /usr/src/utils +COPY ./utils . + +WORKDIR /usr/src/proto +COPY ./proto . WORKDIR /usr/src/character-service COPY ./character-service . diff --git a/database-service/Dockerfile b/database-service/Dockerfile index 8a08c55..c340a18 100644 --- a/database-service/Dockerfile +++ b/database-service/Dockerfile @@ -1,16 +1,19 @@ -FROM rust:1.83 AS builder +FROM rust:1.83-slim-bookworm AS builder LABEL authors="raven" -WORKDIR /usr/src/proto -COPY ./proto . - -WORKDIR /usr/src/utils -COPY ./utils . - RUN apt-get update \ && DEBIAN_FRONTEND=noninteractive \ apt-get install --no-install-recommends --assume-yes \ - protobuf-compiler + pkg-config \ + libssl-dev \ + protobuf-compiler \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /usr/src/utils +COPY ./utils . + +WORKDIR /usr/src/proto +COPY ./proto . WORKDIR /usr/src/database-service COPY ./database-service . diff --git a/frontend/.dockeringnore b/frontend/.dockeringnore new file mode 100644 index 0000000..da91f11 --- /dev/null +++ b/frontend/.dockeringnore @@ -0,0 +1,10 @@ +**/.idea/ +**/node_modules/ +**/dist +.git +npm-debug.log +.coverage +.coverage.* +.env +.aws +nginx.conf* \ No newline at end of file diff --git a/frontend/Dockerfile b/frontend/Dockerfile index a067253..cff81f2 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -1,21 +1,17 @@ # Step 1: Build the React app -FROM node:20 AS build +FROM node:22-alpine AS build # Set working directory WORKDIR /app # Copy package.json and install dependencies COPY package*.json ./ -RUN npm install - -# Copy the source code +RUN npm ci COPY . . - -# Build the React app RUN npm run build # Step 2: Serve the React app using nginx -FROM nginx:1.25 +FROM nginx:alpine # Copy the built React files to the nginx html folder COPY --from=build /app/build /usr/share/nginx/html diff --git a/packet-service/Dockerfile b/packet-service/Dockerfile index e4767b4..c6d8030 100644 --- a/packet-service/Dockerfile +++ b/packet-service/Dockerfile @@ -1,16 +1,19 @@ -FROM rust:1.83 AS builder +FROM rust:1.83-slim-bookworm AS builder LABEL authors="raven" -WORKDIR /usr/src/proto -COPY ./proto . - -WORKDIR /usr/src/utils -COPY ./utils . - RUN apt-get update \ && DEBIAN_FRONTEND=noninteractive \ apt-get install --no-install-recommends --assume-yes \ - protobuf-compiler + pkg-config \ + libssl-dev \ + protobuf-compiler \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /usr/src/utils +COPY ./utils . + +WORKDIR /usr/src/proto +COPY ./proto . WORKDIR /usr/src/packet-service COPY ./packet-service . diff --git a/session-service/Dockerfile b/session-service/Dockerfile index ca3800f..09fa5c6 100644 --- a/session-service/Dockerfile +++ b/session-service/Dockerfile @@ -1,16 +1,19 @@ -FROM rust:1.83 AS builder +FROM rust:1.83-slim-bookworm AS builder LABEL authors="raven" -WORKDIR /usr/src/proto -COPY ./proto . - -WORKDIR /usr/src/utils -COPY ./utils . - RUN apt-get update \ && DEBIAN_FRONTEND=noninteractive \ apt-get install --no-install-recommends --assume-yes \ - protobuf-compiler + pkg-config \ + libssl-dev \ + protobuf-compiler \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /usr/src/utils +COPY ./utils . + +WORKDIR /usr/src/proto +COPY ./proto . WORKDIR /usr/src/session-service COPY ./session-service . diff --git a/world-service/Dockerfile b/world-service/Dockerfile index f2fb28f..ab0e02f 100644 --- a/world-service/Dockerfile +++ b/world-service/Dockerfile @@ -1,16 +1,19 @@ -FROM rust:1.83 AS builder +FROM rust:1.83-slim-bookworm AS builder LABEL authors="raven" -WORKDIR /usr/src/proto -COPY ./proto . - -WORKDIR /usr/src/utils -COPY ./utils . - RUN apt-get update \ && DEBIAN_FRONTEND=noninteractive \ apt-get install --no-install-recommends --assume-yes \ - protobuf-compiler + pkg-config \ + libssl-dev \ + protobuf-compiler \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /usr/src/utils +COPY ./utils . + +WORKDIR /usr/src/proto +COPY ./proto . WORKDIR /usr/src/world-service COPY ./world-service .