Skip to content
Snippets Groups Projects
Commit 5dcda37e authored by Sandro Lutz's avatar Sandro Lutz
Browse files

Use nginx for docker image

parent c579178b
No related merge requests found
......@@ -12,26 +12,11 @@ RUN npm run $NPM_BUILD_COMMAND
# Second stage: Server to deliver files
FROM node:alpine
# Port 8080 can be used as non root
EXPOSE 8080
# Create user with home directory and no password
RUN adduser -Dh /admintool admintool
USER admintool
WORKDIR /admintool
# Install http server
RUN npm install --no-save http-server
FROM nginx:1.15-alpine
# Copy files from first stage
COPY --from=build /index.html /admintool/
COPY --from=build /dist /admintool/dist
# Serve index.html for every file which is not found on the server
# Hotfix for direct links
RUN ln index.html 404.html
COPY --from=build /index.html /var/www/
COPY --from=build /dist /var/www/dist
# Run server (-g will automatically serve the gzipped files if possible)
CMD ["/admintool/node_modules/.bin/http-server", "-g", "/admintool"]
# Copy nginx configuration
COPY nginx.conf /etc/nginx/conf.d/default.conf
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
root /var/www/;
index index.html;
try_files $uri /index.html =404;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment