diff --git a/frontend/Caddyfile b/frontend/Caddyfile new file mode 100644 index 000000000000..92dad003268c --- /dev/null +++ b/frontend/Caddyfile @@ -0,0 +1,34 @@ +{ + auto_https off + admin off +} + +:80 { + @proxied path /api/* /docs /openapi.json + + @static { + file + path *.ico *.css *.js *.gif *.jpg *.jpeg *.png *.svg *.woff *.woff2 *.webp + } + + encode gzip zstd + + # Handles Recipe Images / Assets + handle_path /api/media/recipes/* { + header @static Cache-Control max-age=31536000 + root * /app/data/recipes/ + file_server + } + + handle @proxied { + uri strip_suffix / + reverse_proxy http://mealie-api + } + + handle { + header @static Cache-Control max-age=31536000 + root * /app/dist + try_files {path}.html {path} / + file_server + } +} diff --git a/frontend/Dockerfile b/frontend/Dockerfile new file mode 100644 index 000000000000..b78eda692ad2 --- /dev/null +++ b/frontend/Dockerfile @@ -0,0 +1,47 @@ +FROM node:lts as builder + +WORKDIR /app + +COPY . . + +# Install Caddy +RUN apt-get update \ + && apt-get install --no-install-recommends -y \ + curl \ + apt-transport-https \ + && curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | apt-key add - \ + && curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | tee /etc/apt/sources.list.d/caddy-stable.list \ + && apt-get update \ + && apt-get install --no-install-recommends -y \ + caddy + +RUN yarn install \ + --prefer-offline \ + --frozen-lockfile \ + --non-interactive \ + --production=false + +RUN yarn build + +RUN rm -rf node_modules && \ + NODE_ENV=production yarn install \ + --prefer-offline \ + --pure-lockfile \ + --non-interactive \ + --production=true + +FROM node:15-alpine + +WORKDIR /app + +# copying caddy into image +COPY --from=builder /usr/bin/caddy /usr/bin/caddy +COPY ./Caddyfile /app +COPY --from=builder /app . + +ENV HOST 0.0.0.0 +EXPOSE 3000 + +RUN ["caddy", "start", "--config", "/app/Caddyfile"] + +CMD [ "yarn", "start" ] diff --git a/frontend/components/global/AutoForm.vue b/frontend/components/global/AutoForm.vue index 3ed38fcbcb55..74edc34e9bd2 100644 --- a/frontend/components/global/AutoForm.vue +++ b/frontend/components/global/AutoForm.vue @@ -136,7 +136,7 @@