diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..dd29594 --- /dev/null +++ b/Dockerfile @@ -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 ./ +RUN go mod download +COPY . . +RUN make +ENV GOCACHE=/usr/src/app/.cache +ENTRYPOINT [ "/go/bin/pushup" ] \ No newline at end of file diff --git a/Makefile b/Makefile index c1b0bf9..b707d11 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,11 @@ build: .PHONY: build +build-docker: + docker build -t pushup . + +.PHONY: build-docker + test tests: go test -v . ./_runtime diff --git a/README.md b/README.md index 6caa1c0..a446157 100644 --- a/README.md +++ b/README.md @@ -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) @@ -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.