2018-09-08 15:08:33 +02:00
|
|
|
|
2019-06-02 16:37:10 +02:00
|
|
|
##############
|
|
|
|
# Build stage
|
2022-10-01 17:05:12 +02:00
|
|
|
FROM golang:1.19-alpine AS build-env
|
2022-08-03 17:54:21 +02:00
|
|
|
|
|
|
|
RUN apk --no-cache add build-base git && \
|
|
|
|
go install github.com/magefile/mage@latest && \
|
|
|
|
mv /go/bin/mage /usr/local/go/bin
|
2018-09-08 15:08:33 +02:00
|
|
|
|
|
|
|
ARG VIKUNJA_VERSION
|
|
|
|
|
2019-06-02 16:37:10 +02:00
|
|
|
# Setup repo
|
2022-08-03 12:44:18 +02:00
|
|
|
COPY . /go/src/code.vikunja.io/api
|
|
|
|
WORKDIR /go/src/code.vikunja.io/api
|
2018-09-08 15:08:33 +02:00
|
|
|
|
2019-11-24 18:36:43 +01:00
|
|
|
# Checkout version if set
|
2018-09-08 15:08:33 +02:00
|
|
|
RUN if [ -n "${VIKUNJA_VERSION}" ]; then git checkout "${VIKUNJA_VERSION}"; fi \
|
2021-02-07 22:05:09 +01:00
|
|
|
&& mage build:clean build
|
2018-09-08 15:08:33 +02:00
|
|
|
|
2019-06-02 16:37:10 +02: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 18:36:43 +01:00
|
|
|
# because of this, the container would not start when I compiled the image without cgo.
|
2022-08-03 14:05:07 +02:00
|
|
|
FROM alpine:3.16
|
2018-09-08 15:08:33 +02:00
|
|
|
LABEL maintainer="maintainers@vikunja.io"
|
|
|
|
|
2019-06-02 16:37:10 +02:00
|
|
|
WORKDIR /app/vikunja/
|
|
|
|
COPY --from=build-env /go/src/code.vikunja.io/api/vikunja .
|
2018-11-02 11:01:28 +01:00
|
|
|
ENV VIKUNJA_SERVICE_ROOTPATH=/app/vikunja/
|
|
|
|
|
2020-05-22 21:18:11 +02:00
|
|
|
# Dynamic permission changing stuff
|
|
|
|
ENV PUID 1000
|
|
|
|
ENV PGID 1000
|
2022-08-03 14:05:07 +02:00
|
|
|
RUN apk --no-cache add shadow && \
|
|
|
|
addgroup -g ${PGID} vikunja && \
|
|
|
|
adduser -s /bin/sh -D -G vikunja -u ${PUID} vikunja -h /app/vikunja -H && \
|
|
|
|
chown vikunja -R /app/vikunja
|
2020-05-22 21:18:11 +02:00
|
|
|
COPY run.sh /run.sh
|
|
|
|
|
2022-08-03 14:05:07 +02:00
|
|
|
# Add time zone data
|
|
|
|
RUN apk --no-cache add tzdata
|
2020-02-08 23:18:41 +01:00
|
|
|
|
2019-11-24 18:36:43 +01:00
|
|
|
# Files permissions
|
|
|
|
RUN mkdir /app/vikunja/files && \
|
|
|
|
chown -R vikunja /app/vikunja/files
|
|
|
|
VOLUME /app/vikunja/files
|
|
|
|
|
2020-05-22 21:18:11 +02:00
|
|
|
CMD ["/run.sh"]
|
2019-06-02 16:37:10 +02:00
|
|
|
EXPOSE 3456
|