This repository has been archived on 2024-02-08. You can view files and clone it, but cannot push or open issues or pull requests.
frontend/Dockerfile
branchmispredictor 3f0eab4b74
All checks were successful
continuous-integration/drone/push Build is passing
Fix non-release docker builds (#357)
Merge branch 'master' into bugfix/local-docker-builds

Fix non-release docker builds

Co-authored-by: konrad <konrad@kola-entertainments.de>
Co-authored-by: branchmispredictor <msm595dev@gmail.com>
Reviewed-on: #357
Reviewed-by: konrad <konrad@kola-entertainments.de>
Co-Authored-By: branchmispredictor <branchmispredictor@noreply.mowie.cc>
Co-Committed-By: branchmispredictor <branchmispredictor@noreply.mowie.cc>
2020-12-28 23:28:52 +00:00

46 lines
1.3 KiB
Docker

# Stage 1: Build application
FROM node:13.14.0 AS compile-image
WORKDIR /build
ARG USE_RELEASE=false
ARG RELEASE_VERSION=master
ENV YARN_CACHE_FOLDER .cache/yarn/
COPY . ./
RUN \
if [ $USE_RELEASE = true ]; then \
rm -rf dist/ && \
wget https://dl.vikunja.io/frontend/vikunja-frontend-$RELEASE_VERSION.zip -O frontend-release.zip && \
unzip frontend-release.zip -d dist/ && \
exit 0; \
fi && \
# Build the frontend
yarn install --frozen-lockfile --network-timeout 100000 && \
echo '{"VERSION": "'$(git describe --tags --always --abbrev=10 | sed 's/-/+/' | sed 's/^v//' | sed 's/-g/-/')'"}' > src/version.json && \
yarn run build
# Stage 2: copy
FROM nginx
RUN apt-get update && apt-get install -y apt-utils openssl && \
mkdir -p /etc/nginx/ssl && \
openssl genrsa -out /etc/nginx/ssl/dummy.key 2048 && \
openssl req -new -key /etc/nginx/ssl/dummy.key -out /etc/nginx/ssl/dummy.csr -subj "/C=DE/L=Berlin/O=Vikunja/CN=Vikunja Snakeoil" && \
openssl x509 -req -days 3650 -in /etc/nginx/ssl/dummy.csr -signkey /etc/nginx/ssl/dummy.key -out /etc/nginx/ssl/dummy.crt
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"
CMD "/run.sh"