2020-04-19 19:27:15 +02:00
|
|
|
# Stage 1: Build application
|
2022-04-09 20:00:29 +02:00
|
|
|
FROM node:18-alpine AS compile-image
|
2020-04-19 19:27:15 +02:00
|
|
|
|
|
|
|
WORKDIR /build
|
|
|
|
|
2020-12-16 20:23:38 +01:00
|
|
|
ARG USE_RELEASE=false
|
2021-02-10 18:17:20 +01:00
|
|
|
ARG RELEASE_VERSION=main
|
2020-12-16 20:23:38 +01:00
|
|
|
|
2020-05-05 22:44:58 +02:00
|
|
|
RUN \
|
2020-12-29 00:28:52 +01:00
|
|
|
if [ $USE_RELEASE = true ]; then \
|
2020-12-16 20:23:38 +01:00
|
|
|
wget https://dl.vikunja.io/frontend/vikunja-frontend-$RELEASE_VERSION.zip -O frontend-release.zip && \
|
|
|
|
unzip frontend-release.zip -d dist/ && \
|
|
|
|
exit 0; \
|
2022-04-09 20:00:29 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
ENV PNPM_CACHE_FOLDER .cache/pnpm/
|
|
|
|
|
|
|
|
# pnpm fetch does require only lockfile
|
|
|
|
COPY pnpm-lock.yaml ./
|
|
|
|
|
|
|
|
RUN \
|
|
|
|
# https://pnpm.io/installation#using-corepack
|
|
|
|
corepack enable && \
|
|
|
|
corepack prepare pnpm@7.9.3 --activate && \
|
2020-05-01 12:19:52 +02:00
|
|
|
# Build the frontend
|
2022-04-09 20:00:29 +02:00
|
|
|
pnpm fetch
|
|
|
|
|
|
|
|
ADD . ./
|
|
|
|
|
|
|
|
RUN apk add --no-cache git
|
|
|
|
|
|
|
|
RUN \
|
|
|
|
pnpm install --offline && \
|
|
|
|
echo '{"VERSION": "'$(git describe --tags --always --abbrev=10 | sed 's/-/+/' | sed 's/^v//' | sed 's/-g/-/')'"}' > src/version.json && \
|
|
|
|
pnpm run build
|
2020-04-19 19:27:15 +02:00
|
|
|
|
|
|
|
# Stage 2: copy
|
2022-04-09 20:00:29 +02:00
|
|
|
FROM nginx:alpine
|
2018-09-08 17:56:45 +02:00
|
|
|
|
2020-04-19 19:27:15 +02:00
|
|
|
COPY nginx.conf /etc/nginx/nginx.conf
|
2020-05-05 23:31:01 +02:00
|
|
|
COPY run.sh /run.sh
|
2020-04-19 19:27:15 +02:00
|
|
|
|
|
|
|
# copy compiled files from stage 1
|
|
|
|
COPY --from=compile-image /build/dist /usr/share/nginx/html
|
2019-06-10 22:12:58 +02:00
|
|
|
|
2020-05-22 18:11:20 +02:00
|
|
|
# Unprivileged user
|
|
|
|
ENV PUID 1000
|
|
|
|
ENV PGID 1000
|
|
|
|
|
2020-05-05 23:31:01 +02:00
|
|
|
LABEL maintainer="maintainers@vikunja.io"
|
|
|
|
|
2022-04-09 20:00:29 +02:00
|
|
|
RUN apk add --no-cache \
|
|
|
|
# for sh file
|
|
|
|
bash \
|
|
|
|
# installs usermod and groupmod
|
|
|
|
shadow
|
|
|
|
|
2020-12-29 00:28:52 +01:00
|
|
|
CMD "/run.sh"
|