Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed Docker container #353

Merged
merged 11 commits into from
Jun 12, 2024
Merged

fixed Docker container #353

merged 11 commits into from
Jun 12, 2024

Conversation

nexus-uw
Copy link
Contributor

I was unable to run the docker container as it exists today in the repo. In order to fix it I:

  1. upgraded the base image to lts-alpine (points to node 20 today) in order to slim down the container and keeping the node version up to date
  2. moved some commands around in the Dockerfile so that it builds (was failing with sh: webpack command not found`)
  3. run the Docker container as node user (instead of root)
  4. left some random future upgrade options to improve the container
  5. fixed the docker_start script

additionally, I included the default GitHub action script to build + publish the container to the GitHub repo. this could be removed from the PR if not desired

testing

built + ran the Docker container

- use node:lts-alpine so it stays up to date + slims down container size
- copy over package.json first so that container will only run npm install when deps change
- explicitly expose port
- run as node (aka not root)
- all config from the default github action as of jun 10 2024
revert slim install (forgot about separate client install)
moved NODE_ENV to after build commands (build was failing with sh: webpack not found
@muke1908
Copy link
Owner

@nexus-uw Thanks a lot for the PR. Can you please expand a bit on the purpose of github workflow, where and how it's going to be used?

@nexus-uw
Copy link
Contributor Author

nexus-uw commented Jun 11, 2024

purpose of github workflow,

it will build and publish the Docker container on each commit to the master branch

where

it will publish to the github Docker registry under muke1908/chat-e2ee

how it's going to be used?

people who choose to selfhost chat-e2ee can pull in the latest changes to this project without having to pull the latest from GitHub. this is pretty handy if one is running Docker containers on a host that is running watchtower

@muke1908
Copy link
Owner

@nexus-uw can you please add this info to readme ?

Copy link

sonarcloud bot commented Jun 11, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@nexus-uw
Copy link
Contributor Author

3 further updates were added to this PR (since I'm lazing working against master in my fork)

  1. updated docker readme to include details about the pre-built image (as requested)
  2. when running in prod, have the client set the api endpoint to the current domain. before this, the api was configured to be the default url in the sdk, chat-e2ee-2.azurewebsites.net. since running the server in production mode is serving both the api + client under the same domain, I believe that this is the desired behavior
  3. linting fix for the above


RUN npm run build
# todo - multi part build (lets us slim down container to not unclude all the webpack stuff)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can work on this on the next PR.

currently the docker image is ~750MB. I believe a lot of this coming from the devDependencies

@muke1908 muke1908 merged commit b153788 into muke1908:master Jun 12, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants