-
Notifications
You must be signed in to change notification settings - Fork 238
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
Option to skip COPY . /app
#1037
Comments
Are you sure it's including them in the final image and not just for the build step? |
Positive. I checked in the running container.
I've added these to the nixfile.toml with no change
|
This looks to be a bug with Nixpacks where it will always copy over all files before starting if there is no other |
Would love to attempt a fix if this is up for taking. Can you provide a minimum list of steps to reproduce this? I believe a simple |
I confirm that this remove the unexpected I'm runing nixpacks 1.21.3 Btw, I personnaly have a FROM ghcr.io/railwayapp/nixpacks:ubuntu-1711411379
ENTRYPOINT ["/bin/bash", "-l", "-c"]
WORKDIR /app/
COPY .nixpacks/nixpkgs-5148520bfab61f99fd25fb9ff7bfbb50dad3c9db.nix .nixpacks/nixpkgs-5148520bfab61f99fd25fb9ff7bfbb50dad3c9db.nix
RUN nix-env -if .nixpacks/nixpkgs-5148520bfab61f99fd25fb9ff7bfbb50dad3c9db.nix && nix-collect-garbage -d
COPY .nixpacks/nixpkgs-bf744fe90419885eefced41b3e5ae442d732712d.nix .nixpacks/nixpkgs-bf744fe90419885eefced41b3e5ae442d732712d.nix
RUN nix-env -if .nixpacks/nixpkgs-bf744fe90419885eefced41b3e5ae442d732712d.nix && nix-collect-garbage -d
RUN sudo apt-get update && sudo apt-get install -y --no-install-recommends libnss3 libatk1.0-0 libatk-bridge2.0-0 libcups2 libgbm1 libasound2 libpangocairo-1.0-0 libxss1 libgtk-3-0 libxshmfence1 libglu1
ARG CI NIXPACKS_METADATA NODE_ENV NPM_CONFIG_PRODUCTION PYTHONUNBUFFERED
ENV CI=$CI NIXPACKS_METADATA=$NIXPACKS_METADATA NODE_ENV=$NODE_ENV NPM_CONFIG_PRODUCTION=$NPM_CONFIG_PRODUCTION PYTHONUNBUFFERED=$PYTHONUNBUFFERED
# python:setup phase
# noop
# setup phase
# noop
# install phase
ENV NIXPACKS_PATH /app/node_modules/.bin:$NIXPACKS_PATH
COPY . /app/.
RUN --mount=type=cache,id=BzTYrNyrok-/root/local/share/pnpm/store/v3,target=/root/.local/share/pnpm/store/v3 npm install -g corepack
RUN --mount=type=cache,id=BzTYrNyrok-/root/local/share/pnpm/store/v3,target=/root/.local/share/pnpm/store/v3 corepack enable
RUN --mount=type=cache,id=BzTYrNyrok-/root/local/share/pnpm/store/v3,target=/root/.local/share/pnpm/store/v3 corepack prepare [email protected] --activate
RUN --mount=type=cache,id=BzTYrNyrok-/root/local/share/pnpm/store/v3,target=/root/.local/share/pnpm/store/v3 pnpm install --frozen-lockfile
# python:install phase
# noop
# build phase
COPY . /app/.
RUN --mount=type=cache,id=BzTYrNyrok-node_modules/cache,target=/app/node_modules/.cache pnpm --filter .... build
RUN printf '\nPATH=/app/node_modules/.bin:$PATH' >> /root/.profile
# start
COPY . /app
CMD ["pnpm start"] |
Feature request
It would be great to be able to exclude directories/files that are not supposed to end up in the image.
It was my impression that you would be able to set
onlyIncludeFiles = []
for a phase so you could overwrite default behavior but no matter what phase I hook into, in the end there's always aCOPY . /app
and I can't find a way to disable this behavior. I went through the docs and GH issues but I can't find a solution. Is there a way that I am not seeing or is it not possible? This is relevant for monorepos containing different applications. But even not taking into account monorepos, I think this would potentially help keep images leaner as a whole.As an example, this is a very simple project structure to show a clear use-case of this:
If I want to build project1 (
nixpacks build -c=./project1/nixfile.toml .
) which is independent of project2, I can't currently ignore project2's code.The text was updated successfully, but these errors were encountered: