Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
!yarn.lock
!docker-entrypoint.sh
!build.sh
!start.sh
!default.conf
!server/*
!client/*
**/node_modules/*
50 changes: 24 additions & 26 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,35 +1,33 @@
FROM node:18-bullseye-slim

USER node:node
# Stage 1: Build Stage
FROM node:alpine3.19 AS builder

WORKDIR /home/node
COPY --chown=node:node . .

# Server environmental variables will be put into server/.env
ENV MAILGUN_API_KEY=api-key \
MAILGUN_DOMAIN=darkwire.io \
ABUSE_TO_EMAIL_ADDRESS=abuse@darkwire.io \
ABUSE_FROM_EMAIL_ADDRESS="Darkwire <no-reply@darkwire.io>" \
CLIENT_DIST_DIRECTORY='client/dist/'\
ROOM_HASH_SECRET='some-uuid'\
SITE_URL=https://darkwire.io \
STORE_BACKEND=memory

# Client configuration will be put into client/.env
ENV TZ=UTC \
VITE_API_HOST=localhost \
VITE_API_PROTOCOL=http \
VITE_API_PORT=3001 \
VITE_COMMIT_SHA=some_sha \
VITE_MAX_FILE_SIZE=4
RUN apk update \
&& apk add --no-cache bash \
&& chmod +x /home/node/start.sh \
&& npm install -g yarn@latest --force \
&& yarn install --flat --production --no-cache \
&& yarn build --no-cache \
&& rm -rf /home/node/node_modules \
&& yarn cache clean \
&& yarn autoclean --force

COPY --chown=node:node . .
# Stage 2: Production Stage
Comment thread
jrmi marked this conversation as resolved.
Outdated
FROM node:alpine3.19

RUN yarn && yarn build
WORKDIR /home/node
COPY --from=builder /home/node .

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
EXPOSE 3001

HEALTHCHECK --interval=30s --timeout=30s --start-period=10s --retries=3 \
CMD [ "curl", "-f", "${VITE_API_PROTOCOL}://localhost:${VITE_API_PORT}", "||", "exit", "1" ]
CMD [ "curl", "-f", "http://localhost:3001", "||", "exit", "1" ]

ENTRYPOINT [ "docker-entrypoint.sh" ]
CMD ["yarn", "start"]
CMD ["/home/node/start.sh"]
14 changes: 0 additions & 14 deletions client/.env.dist

This file was deleted.

30 changes: 14 additions & 16 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
],
"license": "MIT",
"dependencies": {
"@react-hookz/web": "^20.0.2",
"@react-hookz/web": "^20.1.0",
"@reduxjs/toolkit": "^1.9.1",
"bootstrap": "^4.6.2",
"classnames": "^2.3.2",
"jquery": "3",
"jquery": "^3.7.1",
"moment": "^2.29.4",
"nanoid": "^4.0.0",
"nanoid": "^4.0.2",
"randomcolor": "^0.6.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand All @@ -32,7 +32,7 @@
"react-tooltip": "^5.2.0",
"redux": "^4.2.0",
"redux-thunk": "^2.4.2",
"sanitize-html": "^2.7.3",
"sanitize-html": "^2.11.0",
"socket.io-client": "^4.5.4",
"tinycon": "^0.6.8"
},
Expand All @@ -45,24 +45,22 @@
"coverage": "TZ=UTC vitest --coverage --watch=false"
},
"devDependencies": {
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/jest-dom": "^6.1.6",
"@testing-library/react": "^14.1.2",
"@testing-library/user-event": "^14.4.3",
"@typescript-eslint/eslint-plugin": "^5.46.0",
"@typescript-eslint/parser": "^5.46.0",
"@vitejs/plugin-react": "^3.0.0",
"@vitest/coverage-istanbul": "^0.25.7",
"@typescript-eslint/eslint-plugin": "^6.16.0",
"@typescript-eslint/parser": "^6.16.0",
"@vitejs/plugin-react": "^4.2.1",
"eslint": "^8.29.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-prettier": "^3.1.3",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.2",
"eslint-plugin-react": "^7.31.11",
"eslint-plugin-react-hooks": "^4.6.0",
"jest-environment-jsdom-sixteen": "^1.0.3",
"jest-fetch-mock": "^3.0.3",
"prettier": "^2.0.5",
"prettier": "^3.1.1",
"sass": "^1.56.2",
"typescript": "^4.9.4",
"vitest": "^0.25.7",
"typescript": "^5.3.3",
"vitest": "^1.1.0",
"vitest-fetch-mock": "^0.2.1"
},
"browserslist": {
Expand Down
2 changes: 1 addition & 1 deletion client/public/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
"background_color": "#ffffff",
"scope": "/",
"description": "Secure and encrypted web chat with Darkwire.io"
}
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this change is unnecessary ;-)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still haven't gotten around to configure my IDE, spends time time fighting docker engine.

1 change: 1 addition & 0 deletions client/src/stylesheets/app.sass
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ button
button.btn-link.btn-plain
padding: 0px
color: white
background-color: black
Comment thread
jrmi marked this conversation as resolved.
text-decoration: none
color: white
&:hover, &:focus
Expand Down
Loading