diff --git a/Dockerfile b/Dockerfile index e6c9758..c8728fe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,33 +1,42 @@ # Stage 1: Build Stage -FROM node:alpine3.19 AS builder +FROM node:current-alpine AS builder -WORKDIR /home/node -COPY --chown=node:node . . +WORKDIR /opt/app +COPY . . RUN apk update \ && apk add --no-cache bash \ - && chmod +x /home/node/start.sh \ + && chmod +x /opt/app/start.sh \ && npm install -g yarn@latest --force \ && yarn install --flat --production --no-cache \ && yarn build --no-cache \ - && rm -rf /home/node/node_modules \ + && rm -rf /opt/app/node_modules \ + && rm -rf /opt/app/server/node_modules \ && yarn cache clean \ && yarn autoclean --force # Stage 2: Production Stage -FROM node:alpine3.19 +FROM alpine:latest -WORKDIR /home/node -COPY --from=builder /home/node . +WORKDIR /opt/app + +COPY --from=builder /opt/app/client/dist /opt/app/client/dist +COPY --from=builder /opt/app/server /opt/app/server +COPY package.json /opt/app/package.json +COPY default.conf /etc/nginx/http.d/ +COPY start.sh /opt/app/start.sh + + + + +RUN apk add --no-cache nginx yarn openssl && \ + chmod +x /opt/app/start.sh -RUN apk add --no-cache curl nginx openssl && \ - rm /etc/nginx/http.d/default.conf && \ - mv /home/node/default.conf /etc/nginx/http.d/ && \ - chmod +x /home/node/start.sh -STOPSIGNAL SIGINT HEALTHCHECK --interval=30s --timeout=30s --start-period=10s --retries=3 \ CMD [ "curl", "-f", "http://localhost:3001", "||", "exit", "1" ] -CMD ["/home/node/start.sh"] +CMD ["/opt/app/start.sh"] + +STOPSIGNAL SIGTERM \ No newline at end of file diff --git a/client/src/components/RoomLink/index.jsx b/client/src/components/RoomLink/index.jsx index 8e2de8b..815541e 100644 --- a/client/src/components/RoomLink/index.jsx +++ b/client/src/components/RoomLink/index.jsx @@ -1,13 +1,15 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { Copy } from 'react-feather'; +import { Clipboard } from 'react-feather'; // Import Clipboard icon for the copy button import { Tooltip } from 'react-tooltip'; const RoomLink = ({ roomId, translations }) => { + const [currentRoomId, setCurrentRoomId] = React.useState(roomId); const [showTooltip, setShowTooltip] = React.useState(false); + const [tooltipMessage, setTooltipMessage] = React.useState(''); const mountedRef = React.useRef(true); - const roomUrl = `${window.location.origin}/${roomId}`; + const roomUrl = `${window.location.origin}/${currentRoomId}`; React.useEffect(() => { mountedRef.current = true; @@ -16,8 +18,9 @@ const RoomLink = ({ roomId, translations }) => { }; }, []); - const handleClick = async () => { + const handleCopyClick = async () => { await navigator.clipboard.writeText(roomUrl); + setTooltipMessage(translations.copyButtonTooltip); setShowTooltip(true); setTimeout(() => { if (mountedRef.current) { @@ -26,34 +29,68 @@ const RoomLink = ({ roomId, translations }) => { }, 2000); }; + const handleRefreshClick = () => { + window.location.href = roomUrl; // Reload the page with the current room URL + }; + + const handleRoomIdChange = (e) => { + setCurrentRoomId(e.target.value); + }; + return ( -