api/Dockerfile

41 lines
1.3 KiB
Docker
Raw Normal View History

2023-01-27 17:41:48 +00:00
# syntax=docker/dockerfile:1
# ┬─┐┬ ┐o┬ ┬─┐
# │─││ │││ │ │
# ┘─┘┘─┘┘┘─┘┘─┘
2018-09-08 13:08:33 +00:00
2023-01-27 17:41:48 +00:00
FROM techknowlogick/xgo:go-1.19.2 AS builder
2023-01-27 17:41:48 +00:00
RUN go install github.com/magefile/mage@latest && \
mv /go/bin/mage /usr/local/go/bin
2018-09-08 13:08:33 +00:00
WORKDIR /go/src/code.vikunja.io/api
2023-01-27 17:41:48 +00:00
COPY . ./
2018-09-08 13:08:33 +00:00
ARG TARGETOS TARGETARCH TARGETVARIANT
2018-09-08 13:08:33 +00:00
2023-01-27 17:41:48 +00:00
RUN mage build:clean && \
mage release:xgo "${TARGETOS}/${TARGETARCH}/${TARGETVARIANT}"
# ┬─┐┬ ┐┌┐┐┌┐┐┬─┐┬─┐
# │┬┘│ │││││││├─ │┬┘
# ┘└┘┘─┘┘└┘┘└┘┴─┘┘└┘
2019-06-02 14:37:10 +00:00
# The actual image
# Note: I wanted to use the scratch image here, but unfortunatly the go-sqlite bindings require cgo and
2019-11-24 17:36:43 +00:00
# because of this, the container would not start when I compiled the image without cgo.
2023-01-27 17:41:48 +00:00
FROM alpine:3.16 AS runner
2018-09-08 13:08:33 +00:00
LABEL maintainer="maintainers@vikunja.io"
2019-06-02 14:37:10 +00:00
WORKDIR /app/vikunja/
2023-01-27 17:41:48 +00:00
ENTRYPOINT [ "/app/vikunja/vikunja" ]
ENV VIKUNJA_SERVICE_ROOTPATH=/app/vikunja/
2023-01-27 17:41:48 +00:00
RUN apk --update --no-cache add tzdata && \
addgroup -g 1000 vikunja && \
adduser -s /bin/sh -D -G vikunja -u 1000 vikunja -h /app/vikunja -H && \
mkdir files && \
chown vikunja:vikunja files
COPY --from=builder --chown=vikunja:vikunja /build/vikunja-* vikunja
2023-01-27 17:49:09 +00:00
USER vikunja