
In the top right corner of the texture, you put a pixel with some specific value. The RGBA value is as follows:
R - The amount of frames in the texture.
G - The framerate of the animation (doesn't matter if the amount of frames is 1).
B - The width of the vanilla container.
A - The height of the vanilla container.
After that, put the container at the center of the texture, you can just reload the resourcepack to see if you positioned it correctly.
If your container is animated, you can increase the texture size to fit the extra frames, the shaders will read the animation from left to right, top to bottom, each frame has to be 256x256.
If you need an example you can look at both the inventory.png and inventory_without_animation.png textures.