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

Adding a Dockerfile for quick start #58

Merged
merged 8 commits into from
Jan 18, 2023
Merged

Adding a Dockerfile for quick start #58

merged 8 commits into from
Jan 18, 2023

Conversation

orenfromberg
Copy link
Contributor

This branch adds a Dockerfile to potentially reduce friction with installing pushup.

A Makefile recipe is added to build the docker image locally until it is hosted on an image repository.

The README.md includes a quick start section to run the Pushup CLI. It mounts the current directory and runs the container with the same user/group to preserve file permissions. The Pushup CLI should be able to create the new scaffolding for a project, build it, and run it on localhost:8080.

Since the docker container is running go without the user having a home directory, it needs to set GOCACHE to use a hidden directory .cache in the mounted volume.

All feedback is welcome.

RUN apk add build-base git
WORKDIR /usr/src/app
# pre-copy/cache go.mod for pre-downloading dependencies and only redownloading them in subsequent builds if they change
COPY go.mod go.sum ./
Copy link
Contributor

Choose a reason for hiding this comment

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

you can add a RUN go mod download between this and the COPY . . to download dependencies only on changes to go.mod - otherwise make will do so on every run

Copy link
Contributor

@llimllib llimllib left a comment

Choose a reason for hiding this comment

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

This feels overall kind of weird to me - like putting a Dockerfile at the root of the rails repository? What similar tools include a dockerfile for running them? Do you normally run tools this way?

I tried to think of similar tools to check, and none have dockerfiles at the root: rails, express, webpack-dev-server, gopls

@orenfromberg
Copy link
Contributor Author

This feels overall kind of weird to me - like putting a Dockerfile at the root of the rails repository? What similar tools include a dockerfile for running them? Do you normally run tools this way?

I tried to think of similar tools to check, and none have dockerfiles at the root: rails, express, webpack-dev-server, gopls

hugo has a Dockerfile. The main benefit of this is not needing to install golang (which I had to do to test pushup out the first time). If this doesn't seem useful, then I'm fine closing the PR.

@paulsmith
Copy link
Contributor

It occurred to me that a practical reason to have a Dockerfile/container image is that Pushup requires Go at runtime to compile the generated project. Someone could use the Pushup container to build their site without needing to install Go explicitly.

@paulsmith
Copy link
Contributor

@orenfromberg Can you fix up the conflicts? I'd like to merge this.

README.md Outdated
## Quick start with Docker

```shell
git clone [email protected]:AdHocRandD/pushup.git
Copy link
Contributor

Choose a reason for hiding this comment

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

README.md Outdated
Then create a scaffolded new project in the current directory:

```shell
docker run --rm -v $(pwd):/usr/src/app --user $(id -u):$(id -g) -p 8080:8080 pushup new
Copy link
Contributor

Choose a reason for hiding this comment

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

This will fail, because pushup new won't do its thing in a non-empty directory. Please change it to use an argument like myproject.

Copy link
Contributor

@paulsmith paulsmith left a comment

Choose a reason for hiding this comment

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

Thanks, @orenfromberg !

@paulsmith paulsmith merged commit eca5ef7 into main Jan 18, 2023
@paulsmith paulsmith deleted the oren/dockerfile branch January 18, 2023 21:57
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