We demonstrate a compact technique to compress electron pulses to attosecond length, while keeping the energy spread reasonably small. The technique is based on Dielectric Laser Acceleration (DLA) in nanophotonic silicon structures. Unlike previous ballistic optical microbunching demonstrations, we use a modulator-demodulator scheme to compress phase space in the time and energy coordinates. With a second stage, we show that these pulses can be coherently accelerated, producing a net energy gain of $1.5pm0.1$ keV, which is significantly larger than the remaining energy spread of $0.88 ,_{-0.2}^{+0.0}$ keV FWHM. We show that by linearly sweeping the phase between the two stages, the energy spectrum can be coherently moved in a periodic manner, while keeping the energy spread roughly constant. After leaving the buncher, the electron pulse is also transversely focused, and can be matched into a following accelerator lattice. Thus, this setup is the prototype injector into a scalable DLA based on Alternating Phase Focusing (APF).