We consider an infinite chain of particles linearly coupled to their nearest neighbours and subject to an anharmonic local potential. The chain is assumed weakly inhomogeneous, i.e. coupling constants, particle masses and on-site potentials can have small variations along the chain. We look for small amplitude and time-periodic solutions, and in particular spatially localized ones (discrete breathers). The problem is reformulated as a nonautonomous recurrence in a space of time-periodic functions, where the dynamics is considered along the discrete spatial coordinate. Generalizing to nonautonomous maps a centre manifold theorem previously obtained for infinite-dimensional autonomous maps [Jam03], we show that small amplitude oscillations are determined by finite-dimensional nonautonomous mappings, whose dimension * Corresponding author 1 depends on the solutions frequency. We consider the case of two-dimensional reduced mappings, which occurs for frequencies close to the edges of the phonon band (computed for the unperturbed homogeneous chain). For an homogeneous chain, the reduced map is autonomous and reversible, and bifurcations of reversible homoclinic orbits or heteroclinic solutions are found for appropriate parameter values. These orbits correspond respectively to discrete breathers for the infinite chain, or "dark" breathers superposed on a spatially extended standing wave. Breather existence is shown in some cases for any value of the coupling constant, which generalizes (for small amplitude solutions) an existence result obtained by MacKay and Aubry at small coupling [MA94]. For an inhomogeneous chain the study of the nonautonomous reduced map is in general far more involved. Here this problem is considered when the chain presents a finite number of defects. For the principal part of the reduced recurrence, using the assumption of weak inhomogeneity, we show that homoclinics to 0 exist when the image of the unstable manifold under a linear transformation (depending on the defect sequence) intersects the stable manifold. This provides a geometrical understanding of tangent bifurcations of discrete breathers commonly observed in classes of systems with impurities as defect strengths are varied. The case of a mass impurity is studied in detail, and our geometrical analysis is successfully compared with direct numerical simulations. In addition, a class of homoclinic orbits is shown to persist for the full reduced mapping and yields a family of discrete breathers with maximal amplitude at the impurity site.