Skip to content

Commit

Permalink
updated dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
ErenKaya1 committed May 14, 2021
1 parent 49c02bc commit e4c783d
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
VUE_APP_I18N_LOCALE=tr
VUE_APP_I18N_FALLBACK_LOCALE=tr
VUE_APP_BACKEND_URL="http://localhost:5001"
VUE_APP_BACKEND_URL=http://api.erenkaya.tk
12 changes: 7 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
FROM node:lts-alpine
RUN npm install -g http-server
FROM node:latest as build-stage
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
COPY ./ .
RUN npm run build
EXPOSE 8080
CMD [ "http-server", "dist" ]

FROM nginx as production-stage
RUN mkdir /app
COPY --from=build-stage /app/dist /app
COPY nginx.conf /etc/nginx/nginx.conf
30 changes: 30 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
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;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location / {
root /app;
index index.html;
try_files $uri $uri/ /index.html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
}
5 changes: 5 additions & 0 deletions src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ const routes = [
name: "MenuError",
component: () => import(/* webpackChunkName: "menu-error" */ "@/views/MenuError.vue"),
},
{
path: "*",
name: "NotFound",
component: () => import(/* webpackChunkName: "not-found" */ "@/views/404.vue"),
},
];

const router = new VueRouter({
Expand Down
2 changes: 1 addition & 1 deletion src/services/httpClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import router from "@/router/index";
import cookie from "vue-cookie";

const httpClient = axios.create({
baseURL: process.env.VUE_APP_BACKEND_URL || "http://localhost:5001",
baseURL: process.env.VUE_APP_BACKEND_URL || "http://api.erenkaya.tk",
withCredentials: true,
});

Expand Down
10 changes: 10 additions & 0 deletions src/views/404.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<template>
<div>404</div>
</template>

<script>
export default {};
</script>

<style>
</style>

0 comments on commit e4c783d

Please sign in to comment.