leafac / kill-the-newsletter

Convert email newsletters into Atom feeds
https://kill-the-newsletter.com
MIT License
2.31k stars 113 forks source link

Docker #20

Closed jtagcat closed 3 years ago

jtagcat commented 3 years ago

Hey, could you provide a docker image?

leafac commented 3 years ago

I like the idea and I’ll leave the issue open if you or someone else want to chip in and help. Unfortunately I’m short on time and can’t take this myself right now. It should be relatively easy: it’s a typical Node.js application that requires ports for HTTP and SMTP, and a volume to store the feeds.

ghost commented 3 years ago

I'm working on making one! If the latest commit could be tagged as a release (assuming it's release-worthy), that would be super helpful.

Edit: You should probably add "package-lock.json" and the "node_modules" folder to your .gitignore, since it's causing issues when trying to run npm install. I guess that means those fonts will have to be downloaded separately?

You may also need to update the dependencies, since I'm basically compiling the whole thing from source. I can get around that by installing both the dev and prod dependencies, but that doesn't feel very clean.

Edit 2: Can you remove the open command from the npm start script? Otherwise, I think I have a working dockerfile I can send you.

leafac commented 3 years ago

I just released some changes that I have been cooking for a while. These changes should make adding Docker support easier. The main thing you need to know is that I’m no longer compiling the TypeScript source to JavaScript and them running the resulting files (you’ll no longer see src/ and lib/ folders), instead I just run the TypeScript source directly with ts-node (tests are run with ts-jest, but for deployment you probably don’t care about this). One consequence of this change is that many development dependencies are now production dependencies.

If the latest commit could be tagged as a release (assuming it's release-worthy), that would be super helpful.

I pushed the code with the modifications mentioned above to the 1.0.0 tag.

You should probably add "package-lock.json" and the "node_modules" folder to your .gitignore, since it's causing issues when trying to run npm install.

What issues?

You don’t need to npm install under the static/ folder. That’s what I did to include the fonts, but they’re already committed to the repository.

Adding package-lock.json to .gitignore is a thing I may do in an npm package that is a library. But this is an application. Am I missing something?

The node_modules/ of the application is on the .gitignore. There’s also static/node_modules/, but that’s just a convenient way to install fonts—it shouldn’t be in gitignore.

You may also need to update the dependencies, since I'm basically compiling the whole thing from source. I can get around that by installing both the dev and prod dependencies, but that doesn't feel very clean.

I believe this is no longer an issue since the modifications mentioned above. Now the only development dependencies are those related to testing.

Can you remove the open command from the npm start script?

Can you instead have something like RUN npx ts-node .? This way we keep everything that is working unchanged.

Otherwise, I think I have a working dockerfile I can send you.

Awesome! I’m looking forward for your pull request. Please also write a section in the README explaining how to use the Docker support.

nemosmithasf commented 3 years ago

Excited the see this happen, thanks guys.

leafac commented 3 years ago

Thank you all for your help. I tested the Docker support myself and it’s working. See https://github.com/leafac/www.kill-the-newsletter.com/tree/b9907a8021cebd6cd4a4b3131fd31ac5aa0a2e37