Zmeny potrebne pro deploy na poletani.cz

This commit is contained in:
Michal Kváček
2023-08-24 13:37:14 +02:00
parent 19b078b43c
commit ccc8ff22e2
9 changed files with 89 additions and 8 deletions
+8 -2
View File
@@ -8,11 +8,17 @@ COPY . .
# build stage # build stage
FROM develop-stage as build-stage FROM develop-stage as build-stage
#ARG API_URL
#ENV VUE_API_URL $API_URL
RUN yarn --production=false RUN yarn --production=false
RUN quasar build RUN quasar build
# production stage # production stage
FROM nginx:1.17.5-alpine as production-stage FROM nginx:1.25-alpine as production-stage
COPY --from=build-stage /app/dist/spa /usr/share/nginx/html COPY conf/nginx.conf /etc/nginx/nginx.conf
COPY --from=build-stage /app/dist/spa /app/html
EXPOSE 80 EXPOSE 80
CMD ["nginx", "-g", "daemon off;"] CMD ["nginx", "-g", "daemon off;"]
+50
View File
@@ -0,0 +1,50 @@
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
map $sent_http_content_type $expires {
default 90d;
text/html 0;
}
server {
listen 80 default;
server_name poletani.cz;
charset utf-8;
client_max_body_size 20M;
root /app/html;
location / {
index index.html;
expires $expires;
try_files $uri /index.html;
}
}
}
Executable
+18
View File
@@ -0,0 +1,18 @@
#!/bin/bash
IMAGE_NAME="poletani/app"
TAG="latest"
DOCKER_REGISTRY="docker.kvacek.cz"
CONTAINER_IMAGE="$DOCKER_REGISTRY/$IMAGE_NAME:$TAG"
docker login $DOCKER_REGISTRY
# na Ubuntu je potreba sudo apt install gnupg2 pass
docker build -t $CONTAINER_IMAGE .
docker push $CONTAINER_IMAGE
# TODO: nahrat docker-compose.prod.yml
# TODO: spustit dc down && dc up
# TODO: nahravat i config pro apache?
# TODO: api -> alembic
+6
View File
@@ -0,0 +1,6 @@
version: "3.3"
services:
poletani-app:
image: "docker.kvacek.cz/poletani/app:latest"
ports:
- 9000:80
+2
View File
@@ -34,6 +34,8 @@ services:
- ./public:/app/public - ./public:/app/public
- ./node_modules:/app/node_modules:delegated - ./node_modules:/app/node_modules:delegated
command: quasar dev command: quasar dev
environment:
VUE_API_URL: "http://localhost:8000"
# nginx: # nginx:
# image: # image:
Executable → Regular
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 MiB

After

Width:  |  Height:  |  Size: 1.0 MiB

+2 -1
View File
@@ -11,7 +11,7 @@
const {configure} = require('quasar/wrappers'); const {configure} = require('quasar/wrappers');
module.exports = configure(function (/* ctx */) { module.exports = configure(function (ctx) {
return { return {
eslint: { eslint: {
// fix: true, // fix: true,
@@ -59,6 +59,7 @@ module.exports = configure(function (/* ctx */) {
}, },
env: { env: {
API_URL: ctx.dev ? 'http://localhost:8000' : 'https://api.poletani.cz',
GOOGLE_MAPS_API_KEY: "AIzaSyAfTU1VntF9rp2D9TR4CFXIMALF5GLgsio" GOOGLE_MAPS_API_KEY: "AIzaSyAfTU1VntF9rp2D9TR4CFXIMALF5GLgsio"
}, },
+1 -2
View File
@@ -1,10 +1,9 @@
import {boot} from 'quasar/wrappers' import {boot} from 'quasar/wrappers'
import axios from 'axios' import axios from 'axios'
import {useUserStore} from "stores/User"; import {useUserStore} from "stores/User";
import {useRouter} from "vue-router";
const api = axios.create({ const api = axios.create({
baseURL: 'http://localhost:8000', baseURL: process.env.API_URL,
withCredentials: true, withCredentials: true,
xsrfHeaderName: "X-CSRF-TOKEN", xsrfHeaderName: "X-CSRF-TOKEN",
headers: { headers: {
+2 -3
View File
@@ -1,14 +1,13 @@
import {ApolloClient, ApolloLink, fromPromise, HttpLink, InMemoryCache} from '@apollo/client/core' import {ApolloClient, ApolloLink, fromPromise, InMemoryCache} from '@apollo/client/core'
import {createApolloProvider} from "@vue/apollo-option"; import {createApolloProvider} from "@vue/apollo-option";
import {createUploadLink} from 'apollo-upload-client'; import {createUploadLink} from 'apollo-upload-client';
import {onError} from "@apollo/client/link/error"; import {onError} from "@apollo/client/link/error";
import {useUserStore} from "stores/User"; import {useUserStore} from "stores/User";
import {useRoute, useRouter} from "vue-router";
import {useAppStore} from "stores/App"; import {useAppStore} from "stores/App";
const uploadLink = createUploadLink({ const uploadLink = createUploadLink({
uri: 'http://localhost:8000/graphql', uri: process.env.API_URL+'/graphql',
}) })
const handleRefreshToken = (forward, operation) => { const handleRefreshToken = (forward, operation) => {