fix ci/cd

This commit is contained in:
hay-kot 2021-08-07 20:21:44 -08:00
parent a2508e5bbe
commit 886d1b7a50
5 changed files with 99 additions and 12 deletions

34
frontend/Caddyfile Normal file
View File

@ -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
}
}

47
frontend/Dockerfile Normal file
View File

@ -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" ]

View File

@ -136,7 +136,7 @@
<script>
import { validators } from "@/composables/use-validators";
import { fieldTypes } from "@/composables/forms";
import { ref } from "@vue/composition-api";
import { ref } from "@nuxtjs/composition-api";
const BLUR_EVENT = "blur";

View File

@ -140,7 +140,7 @@
<script>
import { validators } from "@/composables/use-validators";
import { fieldTypes } from "@/composables/forms";
import { ref } from "@vue/composition-api";
import { ref } from "@nuxtjs/composition-api";
const BLUR_EVENT = "blur";

View File

@ -1,3 +1,5 @@
// TODO: Fix composition API "Should only be called once" error
export default {
// Global page headers: https://go.nuxtjs.dev/config-head
head: {
@ -64,14 +66,6 @@ export default {
"@nuxtjs/proxy",
],
proxy: {
// see Proxy section
"/api": {
changeOrigin: true,
target: "http://localhost:9000",
},
},
auth: {
redirect: {
login: "/user/login",
@ -183,7 +177,17 @@ export default {
},
// Axios module configuration: https://go.nuxtjs.dev/config-axios
axios: {},
axios: {
proxy: true,
},
proxy: {
// see Proxy section
"/api": {
changeOrigin: true,
target: process.env.NODE_ENV === "production" ? "http://mealie-api:9000" : "http://localhost:9000",
},
},
// PWA module configuration: https://go.nuxtjs.dev/pwa
pwa: {
@ -230,5 +234,7 @@ export default {
},
// Build Configuration: https://go.nuxtjs.dev/config-build
build: {},
build: {
transpile: [/@vue[\\/]composition-api/],
},
};