Skip to content

Commit

Permalink
Added: Nginx conf
Browse files Browse the repository at this point in the history
  • Loading branch information
djuarezgf committed Oct 11, 2024
1 parent 0c363e8 commit f9e39c2
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,4 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Query execution as checkbox
- Github CI
- VUE_APP_PUBLIC_PATH
- Nginx conf
26 changes: 23 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,29 @@
FROM node:alpine
# Stage 1: Build the Vue application
FROM node:alpine AS build

WORKDIR /app

# Copy package files and install dependencies
COPY package.json package-lock.json ./
RUN npm install

# Copy the rest of your application code
COPY . .

RUN npm run build
# Build the Vue application
RUN npm run build:standalone

# Stage 2: Serve the application with Nginx
FROM nginx:alpine

# Copy the built Vue application from the previous stage
COPY --from=build /app/dist /usr/share/nginx/html

# Copy custom Nginx configuration if needed
COPY nginx.conf /etc/nginx/conf.d/default.conf

# Expose port 80 for the Nginx server
EXPOSE 80

CMD npm run serve:standalone
# Nginx will run automatically
CMD ["nginx", "-g", "daemon off;"]
38 changes: 38 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
worker_processes 1;

events {
worker_connections 1024;
}

http {
server {
listen 80;
root /usr/share/nginx/html;
index main.ts;
include /etc/nginx/mime.types;

gzip on;
gzip_min_length 1000;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;

location / {
# add_header Access-Control-Allow-Origin "${TEILER_ORCHESTRATOR_URL}"; # To be added for running within the Teiler
try_files $uri $uri/ /index.html;
add_header Cache-Control "no-cache";
}

location ^~ /config/ {
add_header Cache-Control "no-cache";
add_header X-Content-Type-Options nosniff;
}

location ~ \.(css|js|woff|woff2|png|svg|jpg|jpeg)$(.*) {
expires max;
# add_header Access-Control-Allow-Origin "${TEILER_ORCHESTRATOR_URL}"; # To be added for running within the Teiler
add_header Cache-Control "public";
add_header X-Content-Type-Options nosniff;
}

}
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"serve": "vue-cli-service serve",
"serve-https": "vue-cli-service serve --https",
"build": "vue-cli-service build",
"build:standalone": "vue-cli-service build --mode standalone",
"lint": "vue-cli-service lint",
"serve:standalone": "vue-cli-service serve --mode standalone",
"serve-https:standalone": "vue-cli-service serve --https --mode standalone"
Expand Down

0 comments on commit f9e39c2

Please sign in to comment.