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

Can't install packages in lts-alpine (20.9-alpine3.18) #50847

Open
HighWolf opened this issue Nov 21, 2023 · 3 comments
Open

Can't install packages in lts-alpine (20.9-alpine3.18) #50847

HighWolf opened this issue Nov 21, 2023 · 3 comments

Comments

@HighWolf
Copy link

Hi, I'm having an issue when building my image using this dockerfile:

ARG DEPLOY_VERSION=lts-alpine

# ------------------------------------------------
# Stage building code
FROM node:${DEPLOY_VERSION} AS code_builder

RUN mkdir -p /home/node/app/node_modules && mkdir -p /home/node/app/dist && chown -R node:node /home/node/app

RUN apk add --no-cache make gcc g++ python3

WORKDIR /home/node/app

COPY --chown=node:node package*.json ./
COPY --chown=node:node tsconfig.json ./
COPY --chown=node:node ./npm/.npmrc ./

USER node

COPY --chown=node:node ./src ./src

RUN npm clean-install -dd

RUN npm run build
RUN npm prune --omit='dev'

# ------------------------------------------------
# STAGE Deploy
FROM node:${DEPLOY_VERSION} AS deploy

WORKDIR /home/node/app

RUN apk update && apk add --no-cache apk-tools ca-certificates && \
	apk update && apk add --no-cache sqlite sqlite-libs

COPY --from=code_builder /home/node/app/node_modules ./node_modules
COPY --from=code_builder /home/node/app/dist ./dist

RUN mkdir ./storage

EXPOSE 3000 1202

CMD [ "node", "dist/main.js" ]

I have to downgrade the image version to 18-alpine to make it work.

I noticed that when the builder reaches the command RUN npm clean-install -dd it stops showing logs and stays there forever.

Note: I used the following command to build the image:
docker build -t my-image --no-cache --platform linux/arm/v7 .

Originally posted by @HighWolf in nodejs/docker-node#1259 (comment)

@HighWolf
Copy link
Author

HighWolf commented Dec 6, 2023

Update: the issue happens when compiling the image for an armv7 architecture.
not working script: docker build --no-cache --platform linux/arm/v7 -t my_image .

I tested without the platform tag (docker build --no-cache-t my_image .) and it works

@HighWolf
Copy link
Author

HighWolf commented Feb 6, 2025

@rotu
Copy link

rotu commented Feb 26, 2025

I think this is the same issue as #53489

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

No branches or pull requests

2 participants