Skip to content
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

feat(docker): wrote dev and prod Dockerfiles #195

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

hakamadare
Copy link

$ docker build \
    -t sweet:dev \
    -f docker/Dockerfile.dev \
    .
$ docker run \
    --rm \
    -it \
    sweet:dev

still to do:

  • write docker-compose files to provide mongodb
  • get mongo connection params from environment
  • automatically populate sweetbot user?
  • untangle dependencies and devDependencies (prod Dockerfile is broken)

@hakamadare
Copy link
Author

hey @lowercasename @wlonk this is still a WIP, i wanna see if i can get the MongoDB portion done and figure out how the app currently consumes MongoDB connection params (looks like they're in a config file now?)

Copy link
Collaborator

@wlonk wlonk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it so far! We'll eventually need good docs, too, to help folks get local dev set up, and consider how to deploy Docker images.


docker/
scripts/

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.git/ here, too, probably.

tap "homebrew/core"
tap "homebrew/services"
brew "mongodb-community"
cask "docker"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be in here? Seems OS X dev specific; I'm not strongly opposed to it, but I would love to talk it through a bit.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's absolutely OS X specific; i had meant it as a convenience for developers on Macs

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docker is absolutely not my strong suit - what's the usual way to handle OS-specific convenience packages? Is it good practice to have them? Can there be a check made to see what the host OS is?

@@ -0,0 +1,24 @@
FROM node:14
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hah, a delight! All my work Docker images have to fuse Node and Python base images together (we have Good Reasons Actually for serving our static assets from our backend).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ugggggg that reminds me, would we consider separating static assets into a webpack bundle and pushing them to S3/CloudFront? probably not something we need to do at current scale

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's a Future Problem.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely a Future Problem, but a solution I'm not opposed to. I think it'll be waiting for the transition away from the model/controller handling so much of the view functionality.

@hakamadare
Copy link
Author

the first milestone i'm aiming for is "yarn docker:dev produces a stand-alone dev instance of the service, with no hard external dependencies"

@wlonk
Copy link
Collaborator

wlonk commented Aug 9, 2020

Using local yarn as a taskrunner for Docker is interesting! A lot of my motivation for using Docker is to avoid having to run yarn locally, since we have to juggle so many versions. But I think what you're describing is reasonable for this use-case!

@hakamadare
Copy link
Author

yup, i figure that since any developer will have a Node environment locally, using yarn as the generic taskrunner makes sense.

@lowercasename
Copy link
Collaborator

You'd be surprised how many people I know seem militantly opposed to yarn just because it's not npm, mind you. I think yarn here is a good shout.

@wlonk
Copy link
Collaborator

wlonk commented Aug 10, 2020

@lowercasename I suspect that's just conservatism; in my experience, yarn is "npm but better on literally every metric" 🤷 I may also be neophilic!

@wlonk
Copy link
Collaborator

wlonk commented Aug 13, 2020

@hakamadare You said this is a WIP; is there anything I can do to help move it forward from that status to a mergeable proposal?

```sh
$ docker build \
    -t sweet:dev \
    -f docker/Dockerfile.dev \
    .
$ docker run \
    --rm \
    -it \
    sweet:dev
```

still to do:
* write docker-compose files to provide mongodb
* get mongo connection params from environment
* automatically populate sweetbot user?
* untangle dependencies and devDependencies (prod Dockerfile is broken)
@hakamadare hakamadare force-pushed the hakamadare/docker-compose branch from de9df4d to a117b5c Compare August 16, 2020 17:40
also some rework of configuration to use env vars rather than entire
files.  still need to fix some references to `config/auth.js`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants