-
Notifications
You must be signed in to change notification settings - Fork 22
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
Import fails when using node alpine docker image #21
Comments
Hi, it seems like your docker image failed to load the correct binary. Can you share more of your Dcokerfile? You might have this issue: https://github.com/sodium-friends/sodium-native/issues/126 |
Sure, its in a PR for one of my projects: dyc3/opentogethertube#209 commit This is what the docker file looks like ### Build stage ###
FROM node:alpine3.11 as build-stage
# Create app directory
WORKDIR /usr/app
# Copy the important file
COPY . .
# Install app dependencies
RUN npm install
# Build the application for deployement
RUN npm run build
### Deployement server nginx ###
FROM node:alpine3.11 as production-stage
# Create app directory
WORKDIR /usr/app/
# Environnement variable redis/postgres/webport
ENV REDIS_PORT 6379
# Environnement variable nodejs
ENV NODE_ENV production
ENV PORT 8080
# Install sqlite3
RUN apk update -q
RUN apk add sqlite curl -q
# Copy from build stage
COPY --from=build-stage /usr/app/ /usr/app/
COPY --from=build-stage /usr/app/docker/scripts/wait_for_db.sh /usr/app/wait_for_db.sh
# Install app dependencies
RUN npm install --production
# Remove all the unnecessary directories
RUN rm -rf docker .github .vscode db public test src
# Remove all the unnecessary files
RUN rm -rf env .browserslistrc .eslintrc.js .gitignore .travis.yml codecov.yaml
RUN rm -rf jest.config.js postcss.config.js vue.config.js babel.config.js docker-compose.yml
RUN mkdir env && touch env/production.env
# Healthcheck API, WEB, REDIS
HEALTHCHECK CMD ( curl -f http://localhost:8080/ || exit 1 )
# Start Server
CMD ["/bin/sh", "wait_for_db.sh", "postgres_db:5432", "--", "npm", "run", "start"] |
Did you see the other issue I linked? I'm not too familiar with docker build stages |
After adding the line
It still fails with the same error. |
@dyc3 what stage did you add it to? |
And what node version is that running? |
The |
This might be helpful to others. FROM node:15-alpine
RUN apk add --no-cache --virtual build-deps python alpine-sdk autoconf libtool automake && \
mkdir -p /prebuilds && cd /prebuilds && npm init -y && npm install sodium-native@3.1.1 && \
apk del build-deps
ENV SODIUM_NATIVE_PREBUILD=/prebuilds/node_modules/sodium-native/ and a new version with node 16 (includes python3 instead of python2): FROM node:16-alpine
RUN apk add --no-cache --virtual build-deps python3 alpine-sdk autoconf libtool automake && \
mkdir -p /prebuilds && cd /prebuilds && npm init -y && npm install sodium-native@3.1.1 && \
apk del build-deps
ENV SODIUM_NATIVE_PREBUILD=/prebuilds/node_modules/sodium-native/ |
I'm using the docker image
node:alpine3.11
to build and deploy my application.The text was updated successfully, but these errors were encountered: