mirror of
https://github.com/thilo-behnke/wasm-pong.git
synced 2026-07-12 19:19:16 +00:00
dockerizing wip
This commit is contained in:
4
.dockerignore
Normal file
4
.dockerignore
Normal file
@@ -0,0 +1,4 @@
|
||||
.idea
|
||||
.github
|
||||
/pkg
|
||||
/target
|
||||
4
client/.dockerignore
Normal file
4
client/.dockerignore
Normal file
@@ -0,0 +1,4 @@
|
||||
/pkg
|
||||
/tests
|
||||
/www/dist
|
||||
/www/node_modules
|
||||
33
client/Dockerfile
Normal file
33
client/Dockerfile
Normal 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
|
||||
@@ -1,3 +0,0 @@
|
||||
FROM nginx:latest
|
||||
COPY default.conf /etc/nginx/conf.d/default.conf
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user