diff --git a/client-test-websocket/Dockerfile b/client-test-websocket/Dockerfile new file mode 100644 index 0000000..603b14c --- /dev/null +++ b/client-test-websocket/Dockerfile @@ -0,0 +1,5 @@ +FROM alpine:edge +RUN apk update && apk add py3-websockets +COPY --chmod=0555 ./entrypoint.sh /entrypoint.sh +COPY --chmod=0555 ./entrypoint.py /entrypoint.py +ENTRYPOINT ["/entrypoint.sh"] diff --git a/client/entrypoint.py b/client-test-websocket/entrypoint.py similarity index 92% rename from client/entrypoint.py rename to client-test-websocket/entrypoint.py index ab0f076..88016e1 100755 --- a/client/entrypoint.py +++ b/client-test-websocket/entrypoint.py @@ -6,7 +6,7 @@ import asyncio from websockets.asyncio.client import connect async def test(): - uri = "ws://server:1080" + uri = "ws://websocket-server:1080" async with connect(uri) as websocket: print(f"Get username via:\n name = os.environ.get('USER')") msg = os.environ.get('USER') diff --git a/client/entrypoint.sh b/client-test-websocket/entrypoint.sh similarity index 100% rename from client/entrypoint.sh rename to client-test-websocket/entrypoint.sh diff --git a/client/Dockerfile b/client/Dockerfile deleted file mode 100644 index 2c7dbb9..0000000 --- a/client/Dockerfile +++ /dev/null @@ -1,5 +0,0 @@ -FROM alpine:edge -RUN apk update && apk add py3-websockets -COPY --chmod=0555 entrypoint.sh /entrypoint.sh -COPY --chmod=0555 entrypoint.py /entrypoint.py -ENTRYPOINT ["/entrypoint.sh"] diff --git a/compose.yml b/compose.yml index 41c95a4..10ad697 100644 --- a/compose.yml +++ b/compose.yml @@ -1,19 +1,27 @@ services: - # the server - server: + # the websocket-server + nginx: + stop_grace_period: 1s + build: 'nginx' + ports: + - 443:443 + volumes: + - ./nginx/ssl.d:/ssl.d + # the websocket-server + websocket-server: stop_grace_period: 1s environment: PYTHONUNBUFFERED: true - build: 'server' + build: 'websocket-server' expose: - 1080 # the client - client: + client-test-websocket: stop_grace_period: 1s environment: USER: ${USER} - build: 'client' + build: 'client-test-websocket' restart: on-failure depends_on: - server: + websocket-server: condition: service_started diff --git a/nginx/Dockerfile b/nginx/Dockerfile new file mode 100644 index 0000000..7d8f267 --- /dev/null +++ b/nginx/Dockerfile @@ -0,0 +1,20 @@ +FROM nginx:latest +RUN < + + +

test websocket

+
+ + +
+
+ diff --git a/server/Dockerfile b/server/Dockerfile deleted file mode 100644 index 2c7dbb9..0000000 --- a/server/Dockerfile +++ /dev/null @@ -1,5 +0,0 @@ -FROM alpine:edge -RUN apk update && apk add py3-websockets -COPY --chmod=0555 entrypoint.sh /entrypoint.sh -COPY --chmod=0555 entrypoint.py /entrypoint.py -ENTRYPOINT ["/entrypoint.sh"] diff --git a/websocket-server/Dockerfile b/websocket-server/Dockerfile new file mode 100644 index 0000000..603b14c --- /dev/null +++ b/websocket-server/Dockerfile @@ -0,0 +1,5 @@ +FROM alpine:edge +RUN apk update && apk add py3-websockets +COPY --chmod=0555 ./entrypoint.sh /entrypoint.sh +COPY --chmod=0555 ./entrypoint.py /entrypoint.py +ENTRYPOINT ["/entrypoint.sh"] diff --git a/server/entrypoint.py b/websocket-server/entrypoint.py similarity index 100% rename from server/entrypoint.py rename to websocket-server/entrypoint.py diff --git a/server/entrypoint.sh b/websocket-server/entrypoint.sh similarity index 100% rename from server/entrypoint.sh rename to websocket-server/entrypoint.sh