Closed nevotheless closed 2 years ago
I think this might be wrong @nevotheless 🤷♀️ or am I reading it the wrong way ? Thank you again for opening a PR. https://github.com/strapi-community/strapi-tool-dockerize/blob/main/templates/Dockerfile.liquid#L26
We are looking inside for /opt/app not /app
That's weird, the generated Dockerfile
i got looks like this
FROM node:16-alpine as build
# Installing libvips-dev for sharp Compatability
RUN apk update && apk add build-base gcc autoconf automake zlib-dev libpng-dev vips-dev && rm -rf /var/cache/apk/* > /dev/null 2>&1
ARG NODE_ENV=production
ENV NODE_ENV=${NODE_ENV}
WORKDIR /opt/
COPY ./package.json ./yarn.lock ./
ENV PATH /opt/node_modules/.bin:$PATH
RUN yarn config set network-timeout 600000 -g && yarn install
WORKDIR /opt/app
COPY ./ .
RUN yarn build
FROM node:16-alpine
RUN apk add vips-dev
RUN rm -rf /var/cache/apk/*
ARG NODE_ENV=production
ENV NODE_ENV=${NODE_ENV}
WORKDIR /app
COPY --from=build /opt/node_modules ./node_modules
ENV PATH /opt/node_modules/.bin:$PATH
COPY --from=build /opt/app ./
EXPOSE 1337
CMD ["yarn", "develop"] // i changed this to develop for the time being
Yeah to verify i just ran
npx @strapi-community/dockerize new --dbclient=mysql --dbhost=localhost --dbport=1234 --dbname=strapi --dbusername=strapi --dbpassword=strapi --projecttype=js --packagemanager=yarn --usecompose=true --env=both
in an empty directory the outcome was this Dockerfile
So the file is incomplete it looks correct ? Workdir is set to /opt/app Try ssh into the container and look what it shows you as paths ?
But WORKDIR
is only set in the builder stage not in the actual "final" stage. When i get into the container the immediate directory is /app
like it is stated in the final stage.
https://github.com/strapi-community/strapi-tool-dockerize/blob/main/templates/Dockerfile-prod.liquid this file seems to be used for the command hence the /app
directory i assume.
I'll check it out then because then we rather want to fix the final stage. Else it would break the rest.
If you care to check or fix the final stage then I bee happy to merge it.
Yeah i can check it out and fix it. Just need to find out how to use the generator shenanigans locally without using npx @strapi-community/dockerize
.
Yeah i can check it out and fix it. Just need to find out how to use the generator shenanigans locally without using npx @strapi-community/dockerize.
Clone down the repo.
then do npm link
in it and you can use strapi-dockerize
to test it locally :)
Thank you again.
I right now ran into this and didn't get why the container didn't write back the changes to the host files. Turns out the bind mount path were wrong and were pointing into
/opt/app
instead of/app
.