[packaging] Use buildx for multi-arch Docker builds (#413)

* update drone to create latest manifest

* add .dockerignore file

* use buildx for multi-arch builds
see https://docs.docker.com/buildx/working-with-buildx/

* don't use RUN commands in Dockerfile
this was breaking multi-arch builds
This commit is contained in:
tobi 2022-02-27 13:03:37 +01:00 committed by GitHub
commit 6b634de6b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 59 additions and 30 deletions

View file

@ -1,5 +1,7 @@
# syntax=docker/dockerfile:1.3
# bundle the admin webapp
FROM node:17.6.0-alpine3.15 AS admin_builder
FROM --platform=${BUILDPLATFORM} node:17.6.0-alpine3.15 AS admin_builder
RUN apk update && apk upgrade --no-cache
RUN apk add git
@ -9,28 +11,16 @@ WORKDIR /gotosocial-admin
RUN npm install
RUN node index.js
FROM alpine:3.15.0 AS executor
RUN apk update && apk upgrade --no-cache
FROM --platform=${TARGETPLATFORM} alpine:3.15.0 AS executor
# copy over the binary from the first stage
RUN mkdir -p /gotosocial/storage
COPY gotosocial /gotosocial/gotosocial
COPY --chown=1000:1000 gotosocial /gotosocial/gotosocial
# copy over the web directory with templates etc
COPY web /gotosocial/web
COPY --chown=1000:1000 web /gotosocial/web
# copy over the admin directory
COPY --from=admin_builder /gotosocial-admin/public /gotosocial/web/assets/admin
COPY --chown=1000:1000 --from=admin_builder /gotosocial-admin/public /gotosocial/web/assets/admin
# make the gotosocial group and user
RUN addgroup -g 1000 gotosocial
RUN adduser -HD -u 1000 -G gotosocial gotosocial
# give ownership of the gotosocial dir to the new user
RUN chown -R gotosocial gotosocial /gotosocial
# become the user
USER gotosocial
WORKDIR /gotosocial
WORKDIR "/gotosocial"
ENTRYPOINT [ "/gotosocial/gotosocial", "server", "start" ]