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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM golang:1.19.1-alpine3.15
RUN apk update upgrade
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

RUN go mod download
COPY . .
RUN make
ENV GOCACHE=/usr/src/app/.cache
ENTRYPOINT [ "/go/bin/pushup" ]
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ build:

.PHONY: build

build-docker:
docker build -t pushup .

.PHONY: build-docker

test tests:
go test -v . ./_runtime

Expand Down
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Pushup is an experiment. In terms of the development life cycle, it should be co
- [Pushup - a page-oriented web framework for Go](#pushup---a-page-oriented-web-framework-for-go)
- [What is Pushup?](#what-is-pushup)
- [Pages in Pushup](#pages-in-pushup)
- [Quick start with Docker](#quick-start-with-docker)
- [Getting started](#getting-started)
- [Installing Pushup](#installing-pushup)
- [Prerequisites](#prerequisites)
Expand Down Expand Up @@ -112,6 +113,24 @@ directory, like `hello.up`. The `.up` extension is important and tells
the compiler that it is a Pushup page. Once you build and run your Pushup app,
that page is automatically mapped to the URL path `/hello`.

## Quick start with Docker

```shell
git clone https://github.com/adhocteam/pushup.git
cd pushup
make build-docker
```

Then create a scaffolded new project in the current directory:

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

See [Creating a new Pushup project](#creating-a-new-pushup-project) for more information.

## Getting started

To make a new Pushup app, first install the main Pushup executable.
Expand Down