I am on my way to deploy a phoenix app into DigitalOcean following this tutorial. Got to step 4, but something seems wrong here:
$ sudo docker build -t docker_phx:0.1.0 .
Sending build context to Docker daemon 279.3MB
Step 1/29 : FROM elixir:1.9-alpine as build
---> 9b250b1bd36e
Step 2/29 : RUN apk add --update git build-base nodejs npm yarn
---> Using cache
---> 74461e1b006f
Step 3/29 : RUN mkdir /app
---> Using cache
---> 3ad300b52050
Step 4/29 : WORKDIR /app
---> Using cache
---> fdd544f23fe7
Step 5/29 : RUN mix do local.hex --force, local.rebar --force
---> Using cache
---> d94ebdd7a0b1
Step 6/29 : ENV MIX_ENV=prod
---> Using cache
---> 35f6c0b2ea69
Step 7/29 : COPY mix.exs mix.lock ./
---> Using cache
---> 9500ee2d53a1
Step 8/29 : COPY config config
---> Using cache
---> ef57967197ed
Step 9/29 : RUN mix deps.get --only $MIX_ENV
---> Using cache
---> d0467cdbc04f
Step 10/29 : RUN mix deps.compile
---> Using cache
---> 291c3e82edd8
Step 11/29 : COPY assets assets
---> 68f637ef212d
Step 12/29 : RUN cd assets && npm install && npm run deploy
---> Running in 1259b634962d
up to date, audited 894 packages in 3s
37 packages are looking for funding
run `npm fund` for details
4 moderate severity vulnerabilities
To address all issues, run:
npm audit fix
Run `npm audit` for details.
> deploy
> webpack --mode production
Invalid options object. Copy Plugin has been initialized using an options object that does not match the API schema.
- options[0] misses the property 'patterns'. Should be:
[non-empty string | object { from, to?, context?, globOptions?, filter?, transformAll?, toType?, force?, priority?, info?, transform?, transformPath?, noErrorOnMissing? }, ...] (should not have fewer than 1 item)
ValidationError: Invalid options object. Copy Plugin has been initialized using an options object that does not match the API schema.
at validate (/app/assets/node_modules/copy-webpack-plugin/node_modules/schema-utils/dist/validate.js:104:11)
at new CopyPlugin (/app/assets/node_modules/copy-webpack-plugin/dist/index.js:38:31)
at module.exports (/app/assets/webpack.config.js:55:7)
at handleFunction (/app/assets/node_modules/webpack-cli/bin/utils/prepareOptions.js:21:13)
at prepareOptions (/app/assets/node_modules/webpack-cli/bin/utils/prepareOptions.js:9:5)
at requireConfig (/app/assets/node_modules/webpack-cli/bin/utils/convert-argv.js:117:14)
at /app/assets/node_modules/webpack-cli/bin/utils/convert-argv.js:123:17
at Array.forEach (<anonymous>)
at module.exports (/app/assets/node_modules/webpack-cli/bin/utils/convert-argv.js:121:15)
at /app/assets/node_modules/webpack-cli/bin/cli.js:71:45
at Object.parse (/app/assets/node_modules/yargs/yargs.js:576:18)
at /app/assets/node_modules/webpack-cli/bin/cli.js:49:8
at Object.<anonymous> (/app/assets/node_modules/webpack-cli/bin/cli.js:366:3)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:14)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:92:18)
at Object.<anonymous> (/app/assets/node_modules/webpack/bin/webpack.js:156:2)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
at internal/main/run_main_module.js:17:47
The command '/bin/sh -c cd assets && npm install && npm run deploy' returned a non-zero code: 1
I really don't know how to solve this, and searching the error didn't help much. Before this error I had a
Node Sass could not find a binding for your current environment: Linux/musl 64-bit with Node.j
fixed with updating node (node -v -> v.14.4.0
) and running npm install
in /assets.
To mention my DockerFile:
FROM elixir:1.9-alpine as build
RUN apk add --update git build-base nodejs npm yarn
RUN mkdir /app
WORKDIR /app
RUN mix do local.hex --force, local.rebar --force
ENV MIX_ENV=prod
COPY mix.exs mix.lock ./
COPY config config
RUN mix deps.get --only $MIX_ENV
RUN mix deps.compile
COPY assets assets
RUN cd assets && npm install && npm run deploy
RUN mix phx.digest
COPY priv priv
COPY lib lib
RUN mix compile
RUN mix release
FROM alpine:3.9 AS app
RUN apk add --update bash openssl postgresql-client
EXPOSE 4000
ENV MIX_ENV=prod
RUN mkdir /app
WORKDIR /app
COPY --from=build /app/_build/prod/rel/docker_phx .
COPY entrypoint.sh .
RUN chown -R nobody: /app
USER nobody
ENV HOME=/app
CMD ["bash", "/app/entrypoint.sh"]
Any thoughts would be appreciated,
Best Regards