-
-
Notifications
You must be signed in to change notification settings - Fork 886
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
No ARM Dockerfile available #3102
Comments
We were having trouble with native ARM builds, so the plan was to cross compile. However that PR ran into problems #2806. For now you can install from scratch. |
I got this error:
I've made some changes in Dockerfile^
Do I need to try build it with |
From the v0.17.4 branch, I was able to successfully use the docker file in So at least this file works |
Hey, there. Any news on this? Would like to update my instance to 0.18.0, but there are still no dockerfiles available. |
@NettoHikari Retrieving the old Dockerfile from the 0.17.4 release still works. #3322 seems to be adding the functionality back as well. |
Someone with knowledge regarding build lemmy/lemmy-ui on arm64 could help me please? I keep getting errors when trying to build lemmy-ui. => [lemmy_lemmy-ui builder 12/18] RUN yarn --production --prefer-offline 1.3s
=> ERROR [lemmy_lemmy-ui builder 13/18] RUN yarn build:prod 2.7s
------
> [lemmy_lemmy-ui builder 13/18] RUN yarn build:prod:
#0 0.564 yarn run v1.22.19
#0 0.638 $ yarn clean && node generate_translations.js
#0 0.975 $ yarn run rimraf dist
#0 1.306 $ /usr/src/app/node_modules/.bin/rimraf dist
#0 1.558 $ webpack --mode=production
#0 2.619 [webpack-cli] Failed to load '/usr/src/app/webpack.config.js' config
#0 2.626 [webpack-cli] Error: Cannot find module 'webpack-bundle-analyzer'
#0 2.626 Require stack:
#0 2.626 - /usr/src/app/webpack.config.js
#0 2.626 - /usr/src/app/node_modules/webpack-cli/lib/webpack-cli.js
#0 2.626 - /usr/src/app/node_modules/webpack-cli/lib/bootstrap.js
#0 2.626 - /usr/src/app/node_modules/webpack-cli/bin/cli.js
#0 2.626 - /usr/src/app/node_modules/webpack/bin/webpack.js
#0 2.626 at Module._resolveFilename (node:internal/modules/cjs/loader:1070:15)
#0 2.626 at Module._load (node:internal/modules/cjs/loader:923:27)
#0 2.626 at Module.require (node:internal/modules/cjs/loader:1137:19)
#0 2.626 at require (node:internal/modules/helpers:121:18)
#0 2.626 at Object.<anonymous> (/usr/src/app/webpack.config.js:10:3)
#0 2.626 at Module._compile (node:internal/modules/cjs/loader:1255:14)
#0 2.626 at Module._extensions..js (node:internal/modules/cjs/loader:1309:10)
#0 2.626 at Module.load (node:internal/modules/cjs/loader:1113:32)
#0 2.626 at Module._load (node:internal/modules/cjs/loader:960:12)
#0 2.626 at Module.require (node:internal/modules/cjs/loader:1137:19) {
#0 2.626 code: 'MODULE_NOT_FOUND',
#0 2.626 requireStack: [
#0 2.626 '/usr/src/app/webpack.config.js',
#0 2.626 '/usr/src/app/node_modules/webpack-cli/lib/webpack-cli.js',
#0 2.626 '/usr/src/app/node_modules/webpack-cli/lib/bootstrap.js',
#0 2.626 '/usr/src/app/node_modules/webpack-cli/bin/cli.js',
#0 2.626 '/usr/src/app/node_modules/webpack/bin/webpack.js'
#0 2.626 ]
#0 2.626 }
#0 2.649 error Command failed with exit code 2.
#0 2.649 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
------
failed to solve: process "/bin/sh -c yarn build:prod" did not complete successfully: exit code: 2 I am using this docker-compose command: docker-compose up --build -d It is failing to build lemmy-ui. lemmy-ui:
build: ./lemmy-ui
# image: lemmy-easy-deploy-lemmy-ui
# image: dessalines/lemmy-ui:0.17.3-linux-arm64
environment:
- LEMMY_UI_LEMMY_INTERNAL_HOST=lemmy:8536
- LEMMY_UI_LEMMY_EXTERNAL_HOST=localhost:1234
- LEMMY_HTTPS=true
volumes:
- ./volumes/lemmy-ui/extra_themes:/app/extra_themes
depends_on:
- lemmy
networks:
- lemmyinternal
- lemmybridge
ports:
- 1234:1234
restart: always
logging: *default-logging I am stuck with this since saturday, any idea is appreciated. |
yeah I'm still stuck on 0.17.4 |
@paulo-roger you can use programming.dev's dockerfile here. https://github.com/programming-dot-dev/lemmy-ui/blob/programming.dev/main/Dockerfile#L30 You need to add the webpack analyzer without adding it to the production dependencies. Also, we have a working github action that deploys a Dockerfile for both arm and amd https://github.com/programming-dot-dev/lemmy-ui/pkgs/container/lemmy-ui Edit: we have customizations to lemmy in that branch though, so be wary of just deploying it outright. We added a 'Request Community' button to the top. |
@snowe2010 your link to the container (https://github.com/programming-dot-dev/lemmy-ui/pkgs/container/lemmy-ui) is dead, fyi |
@CorvetteCole my bad. Package was set to private by default. Updated. you should be able to see it now. |
@snowe2010 are you planning on publishing a package for normal 0.18.0 lemmy? I've managed to get everything building and my ARM instance is running 0.18.0 now. Might publish my own container for those that want to upgrade for now |
You go for it. I think it would probably be best to just make a pr to merge the fix though. I'm not sure what system the devs are using to deploy, but it was dead simple with GitHub actions. |
You're amazing @snowe2010 Thank you so much! |
If anyone is looking for a "vanilla" set of multiarch images, I also build my own here: https://github.com/ubergeek77/lemmy-docker-multiarch
I provide x64 images, ARM32v7 images, and ARM64 images. I have not modified anything apart from making the Dockerfiles more multiarch-friendly. I have images for Normally I'd submit PRs for these Dockerfiles, but the Lemmy team seems determined to configure their Dockerfiles to cross compile. I disagree with that decision, since it prevents ARM hosts from ever being able to build, and since it is cheap and easy to build on real ARM cloud VMs as my workflow does. Each run finishes in 40 minutes and costs me maybe $0.09 total for both images on all architectures, and only 9 minutes/$0.02 when only building the UI. Building on ARM is not that much slower than on x64, so I really don't think cross compilation is worth all the trouble it's been causing. I believe this effort would be better spent focusing on architecture-agnostic Dockerfiles, and improving the current CI/CD pipeline for better multiarch support. The Lemmy team is more than welcome to use mine as a reference. To save costs, multiarch Docker images would only need to be built for release or rc tags, leaving the current CI/CD architecture as-is for development builds. Regardless of my opinion, I think it would be pretty rude of me to submit a PR that clearly conflicts with the direction of the Lemmy team. But at least anyone can use these if they want! |
@ubergeek77 We previously had an ARM builder from a community member which was extremely slow and unreliable, I think it was something similar to Raspberry Pi. A cloud server might be a better option. However I dont think that woodpecker supports launching builders on demand, so it would have to run 24/7. If you would be willing to donate such a builder and manage it, we could definitely use it for releases instead of cross compiling. |
Is there a reason using woodpecker is a hard requirement for building images? It would be trivial to set up a simple GitHub Actions workflow that launches on AWS like I do just for building release images. Your woodpecker CI/CD could stay as-is for per-commit builds. |
Yeah I'm wondering why the usage of woodpecker as well. I'd never even heard of it until this project. |
Hello everyone! |
* Add workaround for #3102 until cross-compile work complete * Minor cleanup --------- Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
I managed to get cross compiling on x64 working in Docker for x64 and ARM64 musl targets. I'm using the BlackDex/rust-musl image used by the Vaultwarden project, which includes a pre-built static PostgreSQL library and OpenSSL. I've tested it in GitHub actions and it builds working images that I'm currently using on my Lemmy instance, running on an ARM64 server. Edit: Performance wise compiling both x64 and ARM64 targets at the same time, takes about 33 mins running on a GItHub actions runner. My Dockerfiles and pre-built images are available at my repository TheSilkky/lemmy-docker. Below is a copy of my working Lemmy Dockerfile, hopefully this is useful (buildx is required): #syntax=docker/dockerfile:1-labs
ARG RUST_VERSION=1.71.0
ARG ALPINE_VERSION=3.18
ARG LEMMY_VERSION
####################################################################################################
## Get source code
####################################################################################################
FROM scratch AS source
ARG LEMMY_VERSION
ADD --keep-git-dir=true https://github.com/LemmyNet/lemmy.git#${LEMMY_VERSION} /lemmy
####################################################################################################
## AMD64 builder base
####################################################################################################
FROM --platform=${BUILDPLATFORM} blackdex/rust-musl:x86_64-musl-stable-${RUST_VERSION} AS base-amd64
ENV DEBIAN_FRONTEND=noninteractive
ENV CARGO_HOME="/root/.cargo"
RUN apt update && apt install -y \
--no-install-recommends \
git
RUN mkdir -pv "${CARGO_HOME}" && \
rustup set profile minimal && \
rustup target add x86_64-unknown-linux-musl
####################################################################################################
## ARM64 builder base
####################################################################################################
FROM --platform=${BUILDPLATFORM} blackdex/rust-musl:aarch64-musl-stable-${RUST_VERSION} AS base-arm64
ENV DEBIAN_FRONTEND=noninteractive
ENV CARGO_HOME="/root/.cargo"
RUN apt update && apt install -y \
--no-install-recommends \
git
RUN mkdir -pv "${CARGO_HOME}" && \
rustup set profile minimal && \
rustup target add aarch64-unknown-linux-musl
####################################################################################################
## AMD64 builder
####################################################################################################
FROM base-amd64 AS build-amd64
WORKDIR /lemmy
COPY --from=source /lemmy ./
RUN echo "pub const VERSION: &str = \"$(git describe --tag)\";" > crates/utils/src/version.rs && \
cargo build --target=x86_64-unknown-linux-musl --release && \
mv target/x86_64-unknown-linux-musl/release/lemmy_server ./lemmy
####################################################################################################
## ARM64 builder
####################################################################################################
FROM base-arm64 AS build-arm64
WORKDIR /lemmy
COPY --from=source /lemmy ./
RUN echo "pub const VERSION: &str = \"$(git describe --tag)\";" > crates/utils/src/version.rs && \
cargo build --target=aarch64-unknown-linux-musl --release && \
mv target/aarch64-unknown-linux-musl/release/lemmy_server ./lemmy
####################################################################################################
## Get target binary
####################################################################################################
FROM build-${TARGETARCH} AS build
####################################################################################################
### Final image
####################################################################################################
FROM alpine:${ALPINE_VERSION}
ARG LEMMY_VERSION
ARG UID=911
ARG GID=911
ARG CONFIG_DIRECTORY=/etc/lemmy
ENV LEMMY_CONFIG_LOCATION="${CONFIG_DIRECTORY}/lemmy.hjson"
RUN apk add --no-cache \
ca-certificates
COPY --from=build --chmod=0755 /lemmy/lemmy /usr/local/bin
RUN addgroup -S -g ${GID} lemmy && \
adduser -S -H -D -G lemmy -u ${UID} -g "" -s /sbin/nologin lemmy && \
mkdir -p "${CONFIG_DIRECTORY}"
USER lemmy
CMD ["lemmy"]
EXPOSE 8536
STOPSIGNAL SIGTERM
LABEL org.opencontainers.image.source="https://github.com/LemmyNet/lemmy.git"
LABEL org.opencontainers.image.version=${LEMMY_VERSION}
LABEL org.opencontainers.image.licenses="AGPL-3.0-or-later"
LABEL org.opencontainers.image.title="Lemmy"
LABEL org.opencontainers.image.description="A link aggregator and forum for the fediverse" |
…emmyNet#3472) * Add workaround for LemmyNet#3102 until cross-compile work complete * Minor cleanup --------- Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
@TheSilkky That looks good. Could you open a pull request with that dockerfile? Then we can use it for ARM release builds. |
@Nutomic Yep I'll open a pull request |
@TheSilkky The docker files in https://github.com/ubergeek77/lemmy-docker-multiarch look a lot less complicated? Is there any advantage to the ones you created? |
@kroese They don't have the CI/CD infrastructure for building on ARM, and have decided to stick with Woodpecker in lieu of a CI/CD that can launch ARM runners. The PR just discussed would build images for ARM, but there is still a gap that people building from ARM will have no official options. |
This comment was marked as abuse.
This comment was marked as abuse.
Hetzner cloud offers ARM64 cloud servers which are billed hourly. So they can be deployed and discarded on demand. Using the Anyway I assume there aren't that much resources needed to build the whole project and its Docker containers the smallest instance would probably do which is, depending on the project's funds, still quite affordable if online 24/7 with less that 5€. |
Just in case somebody is interested in this topic here are sample workflows to create and destroy a CAX11 cloud vm at Hetzner on demand using Github Actions and the Create: https://paste.armbian.com/pukarasopi.yaml What needs to be prepared beforehand
There are a ton of more things to say about this topic like pro/con of pre-generated static IPv4 addresses, using |
For 0.19.0-rc.1 there is an arm64 image available. Can someone confirm that it is working? |
Unfortunately the arm64 which was added recently had to be disabled now as we switched from Alpine to Debian. |
… again Until issue LemmyNet#3102 is open, remove "Supports arm64 / Raspberry Pi."
You can assign me the issue if you will. |
For those interested, I can confirm that https://gitlab.com/ravermeister/lemmy-arm works perfectly |
This issue has been fixed now by #4142 |
Issue Summary
Following the revert of the multi-arch Dockerfile, the Dockerfile.arm file was not readded meaning there's no way to build for arm in the repo. There are also no arm docker images published on Docker Hub for 1.17.4.
Steps to Reproduce
Technical details
Linux CentOS aarch64
The text was updated successfully, but these errors were encountered: