gtsocial-umbx

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

Dockerfile (1963B)


      1 # syntax=docker/dockerfile:1.3
      2 # Dockerfile reference: https://docs.docker.com/engine/reference/builder/
      3 
      4 # stage 1: generate up-to-date swagger.yaml to put in the final container
      5 FROM --platform=${BUILDPLATFORM} quay.io/goswagger/swagger:v0.30.4 AS swagger
      6 
      7 COPY go.mod /go/src/github.com/superseriousbusiness/gotosocial/go.mod
      8 COPY go.sum /go/src/github.com/superseriousbusiness/gotosocial/go.sum
      9 COPY cmd /go/src/github.com/superseriousbusiness/gotosocial/cmd
     10 COPY internal /go/src/github.com/superseriousbusiness/gotosocial/internal
     11 WORKDIR /go/src/github.com/superseriousbusiness/gotosocial
     12 RUN swagger generate spec -o /go/src/github.com/superseriousbusiness/gotosocial/swagger.yaml --scan-models
     13 
     14 # stage 2: generate the web/assets/dist bundles
     15 FROM --platform=${BUILDPLATFORM} node:16.19.1-alpine3.17 AS bundler
     16 
     17 COPY web web
     18 RUN yarn install --cwd web/source && \
     19     BUDO_BUILD=1 node web/source  && \
     20     rm -r web/source
     21 
     22 # stage 3: build the executor container
     23 FROM --platform=${TARGETPLATFORM} alpine:3.17.2 as executor
     24 
     25 # switch to non-root user:group for GtS
     26 USER 1000:1000
     27 
     28 # Because we're doing multi-arch builds we can't easily do `RUN mkdir [...]`
     29 # but we can hack around that by having docker's WORKDIR make the dirs for
     30 # us, as the user created above.
     31 #
     32 # See https://docs.docker.com/engine/reference/builder/#workdir
     33 #
     34 # First make sure storage exists + is owned by 1000:1000, then go back
     35 # to just /gotosocial, where we'll run from
     36 WORKDIR "/gotosocial/storage"
     37 WORKDIR "/gotosocial"
     38 
     39 # copy the dist binary created by goreleaser or build.sh
     40 COPY --chown=1000:1000 gotosocial /gotosocial/gotosocial
     41 
     42 # copy over the web directories with templates, assets etc
     43 COPY --chown=1000:1000 --from=bundler web /gotosocial/web
     44 COPY --chown=1000:1000 --from=swagger /go/src/github.com/superseriousbusiness/gotosocial/swagger.yaml web/assets/swagger.yaml
     45 
     46 VOLUME [ "/gotosocial/storage" ]
     47 ENTRYPOINT [ "/gotosocial/gotosocial", "server", "start" ]