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

Debian Dockerfile refactoring and improvements #347

Merged
merged 3 commits into from
Sep 7, 2021
Merged

Debian Dockerfile refactoring and improvements #347

merged 3 commits into from
Sep 7, 2021

Conversation

gaby
Copy link
Contributor

@gaby gaby commented Sep 7, 2021

  • Migrate from node:14-bullseye to node:14-bullseye-slim image.
  • Remove unnecessary package installation.
  • Apprise publishes a Python wheel for Debian distributions, which allows for removing the installation of development tools (g++, make) and python libraries via apt-get.
  • Decreases by 51% the uncompressed Docker image size from 1.31 GB to 639 MB.

Testing:

  • Built image locally using Ubuntu Focal 20.04 LTS
  • Started the Docker container and added 3 monitors (HTTPS, PING, DNS).
  • I have no way of testing this for ARM.

Screenshot:
uptime-new-build-test

@gaby
Copy link
Contributor Author

gaby commented Sep 7, 2021

Update: I have a Raspberry PI 4 8GB running Raspberry Pi OS (32-bit), I'm going to try build/test the image there too.

@louislam
Copy link
Owner

louislam commented Sep 7, 2021

Thanks, but have to keep the original order, because I believe that this change breaks the cache layer of node-sqlite3 if you put COPY at top. Building node-sqlite3 is painful slow.

  1. WORKDIR /app
  2. node-sqlite3
  3. apprise
  4. COPY . .

@louislam
Copy link
Owner

louislam commented Sep 7, 2021

Update: I have a Raspberry PI 4 8GB running Raspberry Pi OS (32-bit), I'm going to try build/test the image there too.

Thanks for your info, I always thought PI 4 is using arm64

@gaby
Copy link
Contributor Author

gaby commented Sep 7, 2021

Just commited changes, to fix the caching issue with node-sqlite3.

@gaby
Copy link
Contributor Author

gaby commented Sep 7, 2021

Update: I have a Raspberry PI 4 8GB running Raspberry Pi OS (32-bit), I'm going to try build/test the image there too.

Thanks for your info, I always thought PI 4 is using arm64

I just tried building for ARM64 and it fails. The reason being that when the npm install runs, the MapBox team is blocking access to the binaries so it tries to build the whole thing from scratch. See here: TryGhost/node-sqlite3#1389

There's a merge request to fix this here: TryGhost/node-sqlite3#1362

I will work tomorrow on creating a multi-stage build to separate the MapBox into a separate stage. Do not merge this yet. :-)

@louislam
Copy link
Owner

louislam commented Sep 7, 2021

#16 262.2     error: command 'arm-linux-gnueabihf-gcc' failed: No such file or directory
#16 262.2     ----------------------------------------
#16 262.2     ERROR: Failed building wheel for cffi
#16 262.2     Running setup.py clean for cffi

apprise is failed too in my side. I believe those python package is needed.

Sorry about that, but I don't want the docker image to become unstable, and spend time to test it again. I only accept the change of the first line node:14-bullseye-slim. I won't accept other changes.

Please rebase or re-create an pull request for that.

@gaby
Copy link
Contributor Author

gaby commented Sep 7, 2021

@louislam Let me know if it looks good now.

@louislam
Copy link
Owner

louislam commented Sep 7, 2021

Nice, build successfully and smaller size.

@louislam louislam merged commit ea42404 into louislam:master Sep 7, 2021
@Saibamen
Copy link
Contributor

Saibamen commented Sep 7, 2021

@gaby: Can you take a look at #122?

@gaby gaby deleted the refactor-docker branch September 7, 2021 11:53
@gaby
Copy link
Contributor Author

gaby commented Sep 7, 2021

@gaby: Can you take a look at #122?

I did, but from my understanding uptime-kuma is moving away from Alpine because of all the DNS issues.

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.

4 participants