mirror of
https://github.com/offen/website.git
synced 2024-11-25 10:10:28 +01:00
Merge pull request #154 from offen/gin-framework
Build server and all assets into single binary
This commit is contained in:
commit
ded93b59d5
11
.gitignore
vendored
11
.gitignore
vendored
@ -1,9 +1,12 @@
|
||||
.vscode
|
||||
.serverless
|
||||
node_modules/
|
||||
# mkcert certificates
|
||||
*.pem
|
||||
venv/
|
||||
|
||||
bootstrap-alpha.yml
|
||||
Dockerrun.aws.json
|
||||
|
||||
node_modules/
|
||||
dist/
|
||||
*.log
|
||||
|
||||
bin/
|
||||
statik.go
|
||||
|
@ -1,45 +1,3 @@
|
||||
FROM node:10 as auditorium
|
||||
|
||||
COPY ./auditorium/package.json ./auditorium/package-lock.json /code/deps/
|
||||
COPY ./packages /code/packages
|
||||
WORKDIR /code/deps
|
||||
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
|
||||
RUN npm ci
|
||||
COPY ./auditorium /code/auditorium
|
||||
COPY ./banner.txt /code/banner.txt
|
||||
WORKDIR /code/auditorium
|
||||
RUN cp -a /code/deps/node_modules /code/auditorium/
|
||||
ENV NODE_ENV production
|
||||
RUN npm run build
|
||||
|
||||
FROM node:10 as script
|
||||
|
||||
COPY ./script/package.json ./script/package-lock.json /code/deps/
|
||||
COPY ./packages /code/packages
|
||||
WORKDIR /code/deps
|
||||
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
|
||||
RUN npm ci
|
||||
COPY ./script /code/script
|
||||
COPY ./banner.txt /code/banner.txt
|
||||
WORKDIR /code/script
|
||||
RUN cp -a /code/deps/node_modules /code/script/
|
||||
ENV NODE_ENV production
|
||||
RUN npm run build
|
||||
|
||||
FROM node:10 as vault
|
||||
|
||||
COPY ./vault/package.json ./vault/package-lock.json /code/deps/
|
||||
COPY ./packages /code/packages
|
||||
WORKDIR /code/deps
|
||||
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
|
||||
RUN npm ci
|
||||
COPY ./vault /code/vault
|
||||
COPY ./banner.txt /code/banner.txt
|
||||
WORKDIR /code/vault
|
||||
RUN cp -a /code/deps/node_modules /code/vault/
|
||||
ENV NODE_ENV production
|
||||
RUN npm run build
|
||||
|
||||
FROM nikolaik/python-nodejs:python3.7-nodejs10 as homepage
|
||||
|
||||
ARG siteurl
|
||||
@ -64,9 +22,6 @@ ARG robots
|
||||
ENV ROBOTS_FILE=$robots
|
||||
|
||||
COPY --from=homepage /code/homepage/output /www/data
|
||||
COPY --from=script /code/script/dist /www/data
|
||||
COPY --from=auditorium /code/auditorium/dist /www/data/auditorium
|
||||
COPY --from=vault /code/vault/dist /www/data/vault
|
||||
COPY ./build/proxy/$ROBOTS_FILE /www/data/robots.txt
|
||||
COPY ./build/proxy/nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
|
@ -37,13 +37,30 @@ http {
|
||||
location /api/ {
|
||||
proxy_pass http://server;
|
||||
proxy_redirect off;
|
||||
rewrite ^/api(.*)$ $1 break;
|
||||
proxy_hide_header Content-Type;
|
||||
add_header Content-Type "application/json";
|
||||
}
|
||||
|
||||
location /vault/ {
|
||||
proxy_pass http://server;
|
||||
proxy_redirect off;
|
||||
}
|
||||
|
||||
location /auditorium/ {
|
||||
try_files $uri $uri/ /auditorium/index.html;
|
||||
proxy_pass http://server;
|
||||
proxy_redirect off;
|
||||
}
|
||||
|
||||
location /script.js {
|
||||
proxy_pass http://server;
|
||||
proxy_redirect off;
|
||||
}
|
||||
|
||||
location /healthz {
|
||||
proxy_pass http://server;
|
||||
proxy_redirect off;
|
||||
}
|
||||
|
||||
location /favicon.ico {
|
||||
root /www/data/theme/images;
|
||||
}
|
||||
|
||||
error_page 404 /404.html;
|
||||
|
@ -34,6 +34,8 @@ services:
|
||||
command: refresh run
|
||||
links:
|
||||
- server_database
|
||||
ports:
|
||||
- 8081:8080
|
||||
|
||||
server_database:
|
||||
image: postgres:11.2
|
||||
|
@ -2,6 +2,7 @@ Title: Page not found | offen
|
||||
description: offen is a free and open source analytics software for websites and web applications that allows respectful handling of data.
|
||||
save_as: 404.html
|
||||
href: /404.html
|
||||
no_stats: true
|
||||
|
||||
|
||||
![Page not Found](/theme/images/content-404.webp){:class="image-text-560-315"}
|
||||
|
@ -22,7 +22,7 @@
|
||||
{% assets filters="cssmin", output="css/style.min.css", "css/normalize.css", "css/fonts.css", "css/style.css" %}
|
||||
<link rel="stylesheet" href="/{{ ASSET_URL }}">
|
||||
{% endassets %}
|
||||
{% if OFFEN_ACCOUNT_ID %}
|
||||
{% if OFFEN_ACCOUNT_ID and not page.no_stats %}
|
||||
<script async src="/script.js" data-account-id="{{ OFFEN_ACCOUNT_ID }}"></script>
|
||||
{% endif %}
|
||||
</head>
|
||||
|
Loading…
Reference in New Issue
Block a user