Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial Dockerfile contribution #158

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# build the app in a separate build container
FROM node:lts-slim as build
marvin-enthus marked this conversation as resolved.
Show resolved Hide resolved
# Permission for app
RUN mkdir /app && chown node:node /app
WORKDIR /app
COPY --chown=node:node . .
ENV PATH="./node_modules/.bin:$PATH"
USER node
RUN npm ci --no-optional && npm cache clean --force && npm run build
Morl99 marked this conversation as resolved.
Show resolved Hide resolved

# the deployment container
FROM nginx:alpine
marvin-enthus marked this conversation as resolved.
Show resolved Hide resolved
COPY Dockerfile.nginx.config /etc/nginx/conf.d/default.conf
# swap these two lines to use a local build or to utilize the docker build image
COPY --from=build /app/dist /usr/share/nginx/html
#COPY dist /usr/share/nginx/html

# USER nobody

EXPOSE 80
marvin-enthus marked this conversation as resolved.
Show resolved Hide resolved

CMD ["/bin/sh", "-c", "exec nginx -g 'daemon off;'"]
19 changes: 19 additions & 0 deletions Dockerfile.nginx.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# used for nginx container

server {
listen 80;
marvin-enthus marked this conversation as resolved.
Show resolved Hide resolved
location / {
root /usr/share/nginx/html/;
index index.html index.htm;
try_files $uri $uri/ /index.html =404;
}

# security options
# add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self' data:; frame-ancestors 'none'; connect-src 'self';
add_header Referrer-Policy "no-referrer, strict-origin-when-cross-origin";
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains";
add_header X-Content-Type-Options nosniff;
# We allow embedding into an iframe to visualize within the CI system.
# add_header X-Frame-Options DENY;
add_header X-XSS-Protection "1; mode=block";
}
4 changes: 3 additions & 1 deletion vue.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ module.exports = {
transpileDependencies: ["vuetify"],
publicPath:
process.env.NODE_ENV === "production"
? "/" + process.env.REPOSITORY_NAME + "/"
? typeof process.env.REPOSITORY_NAME == "undefined"
? "/"
: "/" + process.env.REPOSITORY_NAME + "/"
: "/",
}