Open dyc3 opened 4 years ago
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: https://github.com/dyc3/opentogethertube/pull/209 commit ddc38da
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
RUN apk --update add --no-cache curl git python alpine-sdk bash autoconf libtool automake
It still fails with the same error.
@dyc3 what stage did you add it to?
And what node version is that running?
The node:alpine3.11
tag runs the latest version of node (13.13.0) on alpine 3.11
This might be helpful to others. I'm using the following Dockerfile instructions using alpine linux. The environment variable helps in finding the prebuilt version:
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.