vikunja-frontend/Dockerfile

50 lines
1.2 KiB
Text
Raw Permalink Normal View History

# Stage 1: Build application
2022-04-09 20:00:29 +02:00
FROM node:18-alpine AS compile-image
WORKDIR /build
ARG USE_RELEASE=false
2021-02-10 18:17:20 +01:00
ARG RELEASE_VERSION=main
2022-09-30 19:13:06 +02:00
ENV PNPM_CACHE_FOLDER .cache/pnpm/
ADD . ./
RUN \
if [ $USE_RELEASE = true ]; then \
wget https://dl.vikunja.io/frontend/vikunja-frontend-$RELEASE_VERSION.zip -O frontend-release.zip && \
unzip frontend-release.zip -d dist/ && \
exit 0; \
2022-09-30 19:13:06 +02:00
fi && \
2022-04-09 20:00:29 +02:00
# https://pnpm.io/installation#using-corepack
corepack enable && \
2022-09-30 19:13:06 +02:00
# we don't use corepack prepare here by intend since
# we have renovate to keep our dependencies up to date
# Build the frontend
2022-09-30 19:13:06 +02:00
pnpm install && \
apk add --no-cache git && \
echo '{"VERSION": "'$(git describe --tags --always --abbrev=10 | sed 's/-/+/' | sed 's/^v//' | sed 's/-g/-/')'"}' > src/version.json && \
pnpm run build
# Stage 2: copy
2022-04-09 20:00:29 +02:00
FROM nginx:alpine
2018-09-08 17:56:45 +02:00
COPY nginx.conf /etc/nginx/nginx.conf
COPY run.sh /run.sh
# copy compiled files from stage 1
COPY --from=compile-image /build/dist /usr/share/nginx/html
# Unprivileged user
ENV PUID 1000
ENV PGID 1000
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
CMD "/run.sh"