Skip to content

Commit

Permalink
Updated CI and nginx.conf for Svelte port
Browse files Browse the repository at this point in the history
  • Loading branch information
ellitedev committed Dec 4, 2023
1 parent 014a5dc commit e3c3e59
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 27 deletions.
25 changes: 19 additions & 6 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,28 @@
# Use a Node.js image to build the Svelte application
FROM node:16 AS build

WORKDIR /app

# Copy package.json and package-lock.json (if available)
COPY package*.json ./

# Install dependencies
RUN npm install

# Copy the rest of your app's source code
COPY . .

# Build the app
RUN npm run build

# Use the official NGINX image as the base
FROM nginx

# Copy the nginx.conf file to the appropriate location
COPY nginx.conf /etc/nginx/nginx.conf

# Install dependencies and compile project
run npm install
run npm run build

# Copy the files from the src folder to the NGINX document root
COPY build /usr/share/nginx/html
# Copy the built application from the first stage
COPY --from=build /app/build /usr/share/nginx/html

# Add a script that will generate the .htpasswd file
COPY generate-htpasswd.sh /usr/local/bin/
Expand Down
19 changes: 0 additions & 19 deletions nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,6 @@ http {
try_files $uri $uri/ =404;
}

location ~* \.(css|js)$ {
root /usr/share/nginx/html;
try_files $uri =404;
expires 1y;
add_header Cache-Control "public";
}

location ~* \.(jpg|jpeg|png|gif|ico|svg|webp|mp3|wav|ogg)$ {
root /usr/share/nginx/html;
try_files $uri =404;
expires 1y;
add_header Cache-Control "public";
}

location = /favicon.ico {
root /usr/share/nginx/html;
try_files $uri =404;
}

location ~* ^/userinfo$ {
auth_basic "Restricted Content";
auth_basic_user_file /etc/nginx/.htpasswd;
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e3c3e59

Please sign in to comment.