dockerizing wip

This commit is contained in:
Thilo Behnke
2022-06-11 18:51:47 +02:00
parent 7e430e3000
commit ca52dee836
5 changed files with 44 additions and 5 deletions

4
.dockerignore Normal file
View File

@@ -0,0 +1,4 @@
.idea
.github
/pkg
/target

4
client/.dockerignore Normal file
View File

@@ -0,0 +1,4 @@
/pkg
/tests
/www/dist
/www/node_modules

33
client/Dockerfile Normal file
View File

@@ -0,0 +1,33 @@
FROM rust:latest as rust_build_stage
RUN apt-get update && apt-get upgrade -y
RUN apt-get install curl
RUN curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
RUN mkdir /build
ADD ./pong /build/pong
ADD ./client /build/client
WORKDIR /build/client
RUN wasm-pack build
FROM node:12 as www_build_stage
RUN mkdir /build
ADD ./client/www /build
WORKDIR /build
COPY --from=rust_build_stage /build/client/pkg/ /build/pkg/
RUN ls /build
RUN ls /build/pkg
RUN npm install
RUN npm run build
FROM nginx:latest
COPY --from=www_build_stage /build/www/dist/ /usr/share/pong/
COPY ./client/nginx/default.conf /etc/nginx/conf.d/default.conf
COPY ./client/nginx/nginx.conf /etc/nginx/nginx.conf

View File

@@ -1,3 +0,0 @@
FROM nginx:latest
COPY default.conf /etc/nginx/conf.d/default.conf
COPY nginx.conf /etc/nginx/nginx.conf

View File

@@ -10,7 +10,7 @@ services:
kafka:
container_name: pong_server_kafka
build:
context: ./server/kafka
context: ./kafka
ports:
- '9092:9092'
- '9093:9093'
@@ -28,7 +28,8 @@ services:
nginx:
container_name: pong_nginx
build:
context: ./nginx
context: ./
dockerfile: ./client/Dockerfile
ports:
- '80:80'
network_mode: 'host'