diff options
author | 2021-07-27 14:45:27 +0200 | |
---|---|---|
committer | 2021-07-27 14:45:27 +0200 | |
commit | fddacdd1a857b4925a67ef5a54ee18004306838b (patch) | |
tree | 4e87976f05b092bae4b4e1e1c94f8f42c3ba46b4 | |
parent | federating db updates (#118) (diff) | |
download | gotosocial-fddacdd1a857b4925a67ef5a54ee18004306838b.tar.xz |
build and bundle admin console + web assets (#119)
-rw-r--r-- | Dockerfile | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/Dockerfile b/Dockerfile index fe94ef5a5..a71b8caf2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,5 @@ -FROM golang:1.16.4-alpine3.13 AS builder +# STEP ONE: build the GoToSocial binary +FROM golang:1.16.4-alpine3.13 AS binary_builder RUN apk update && apk upgrade --no-cache RUN apk add git @@ -23,15 +24,40 @@ ADD build.sh /go/src/github.com/superseriousbusiness/gotosocial/build.sh # do the build step RUN ./build.sh +# STEP TWO: build the web assets +FROM node:16.5.0-alpine3.11 AS web_builder +RUN apk update && apk upgrade --no-cache + +COPY web /web +WORKDIR /web/source + +RUN yarn install +RUN node build.js + +# STEP THREE: bundle the admin webapp +FROM node:16.5.0-alpine3.11 AS admin_builder +RUN apk update && apk upgrade --no-cache +RUN apk add git + +RUN git clone https://github.com/superseriousbusiness/gotosocial-admin +WORKDIR /gotosocial-admin + +RUN npm install +RUN node index.js + +# STEP FOUR: build the final container FROM alpine:3.13 AS executor RUN apk update && apk upgrade --no-cache # copy over the binary from the first stage RUN mkdir -p /gotosocial/storage -COPY --from=builder /go/src/github.com/superseriousbusiness/gotosocial/gotosocial /gotosocial/gotosocial +COPY --from=binary_builder /go/src/github.com/superseriousbusiness/gotosocial/gotosocial /gotosocial/gotosocial # copy over the web directory with templates etc -COPY web /gotosocial/web +COPY --from=web_builder web /gotosocial/web + +# copy over the admin directory +COPY --from=admin_builder /gotosocial-admin/public /gotosocial/web/assets/admin # make the gotosocial group and user RUN addgroup -g 1000 gotosocial |