2018-09-08 13:08:33 +00:00
|
|
|
|
2019-06-02 14:37:10 +00:00
|
|
|
##############
|
|
|
|
# Build stage
|
2019-09-01 09:43:01 +00:00
|
|
|
FROM golang:1-alpine AS build-env
|
2018-09-08 13:08:33 +00:00
|
|
|
|
|
|
|
ARG VIKUNJA_VERSION
|
|
|
|
ENV TAGS "sqlite"
|
2018-10-28 17:38:40 +00:00
|
|
|
ENV GO111MODULE=on
|
|
|
|
ENV GOFLAGS=-mod=vendor
|
2018-09-08 13:08:33 +00:00
|
|
|
|
2019-06-02 14:37:10 +00:00
|
|
|
# Build deps
|
2018-09-08 13:18:57 +00:00
|
|
|
RUN apk --no-cache add build-base git
|
2018-09-08 13:08:33 +00:00
|
|
|
|
2019-06-02 14:37:10 +00:00
|
|
|
# Setup repo
|
2018-09-08 14:10:06 +00:00
|
|
|
COPY . ${GOPATH}/src/code.vikunja.io/api
|
|
|
|
WORKDIR ${GOPATH}/src/code.vikunja.io/api
|
2018-09-08 13:08:33 +00:00
|
|
|
|
2019-11-24 17:36:43 +00:00
|
|
|
# Checkout version if set
|
2018-09-08 13:08:33 +00:00
|
|
|
RUN if [ -n "${VIKUNJA_VERSION}" ]; then git checkout "${VIKUNJA_VERSION}"; fi \
|
2019-07-11 19:10:42 +00:00
|
|
|
&& make clean generate build
|
2018-09-08 13:08:33 +00:00
|
|
|
|
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.
|
2019-06-02 14:37:10 +00:00
|
|
|
FROM alpine:3.9
|
2018-09-08 13:08:33 +00:00
|
|
|
LABEL maintainer="maintainers@vikunja.io"
|
|
|
|
|
2019-06-02 14:37:10 +00:00
|
|
|
WORKDIR /app/vikunja/
|
|
|
|
COPY --from=build-env /go/src/code.vikunja.io/api/vikunja .
|
2019-11-24 17:36:43 +00:00
|
|
|
RUN adduser -S -D vikunja -h /app/vikunja -H \
|
|
|
|
&& chown vikunja -R /app/vikunja
|
2018-11-02 10:01:28 +00:00
|
|
|
ENV VIKUNJA_SERVICE_ROOTPATH=/app/vikunja/
|
|
|
|
|
2019-11-24 17:36:43 +00:00
|
|
|
# Files permissions
|
|
|
|
RUN mkdir /app/vikunja/files && \
|
|
|
|
chown -R vikunja /app/vikunja/files
|
|
|
|
VOLUME /app/vikunja/files
|
|
|
|
|
|
|
|
USER vikunja
|
2019-06-02 14:37:10 +00:00
|
|
|
CMD ["/app/vikunja/vikunja"]
|
|
|
|
EXPOSE 3456
|