diff options
Diffstat (limited to 'client')
| -rw-r--r-- | client/.dockerignore | 4 | ||||
| -rw-r--r-- | client/Dockerfile | 48 | ||||
| -rwxr-xr-x | client/docker-start.sh | 11 | ||||
| -rw-r--r-- | client/nginx.conf.docker | 101 |
4 files changed, 0 insertions, 164 deletions
diff --git a/client/.dockerignore b/client/.dockerignore deleted file mode 100644 index cc2d280..0000000 --- a/client/.dockerignore +++ /dev/null @@ -1,4 +0,0 @@ -node_modules/* -Dockerfile -.dockerignore -**/.gitignore diff --git a/client/Dockerfile b/client/Dockerfile deleted file mode 100644 index 1e3926d..0000000 --- a/client/Dockerfile +++ /dev/null @@ -1,48 +0,0 @@ -FROM --platform=$BUILDPLATFORM node:lts as builder -WORKDIR /opt/app - -COPY package.json package-lock.json ./ -RUN npm install - -COPY . ./ - -ARG BUILD_INFO="docker-latest" -ARG CLIENT_BUILD_ARGS="--debug" -RUN BASE_URL="__BASEURL__" node build.js --gzip ${CLIENT_BUILD_ARGS} - - -FROM --platform=$BUILDPLATFORM nginx:alpine as approot - -# Copy and fix script -COPY docker-start.sh / -RUN apk add --no-cache dos2unix && \ - dos2unix /docker-start.sh && \ - chmod +x /docker-start.sh - -WORKDIR /etc/nginx -COPY nginx.conf.docker ./nginx.conf - -WORKDIR /var/www -COPY --from=builder /opt/app/public/ . - - -FROM nginx:alpine as release - -RUN apk --no-cache add dumb-init -COPY --from=approot / / - -CMD ["/docker-start.sh"] -VOLUME ["/data"] - -ARG DOCKER_REPO -ARG BUILD_DATE -ARG SOURCE_COMMIT -LABEL \ - maintainer="" \ - org.opencontainers.image.title="${DOCKER_REPO}" \ - org.opencontainers.image.url="https://github.com/rr-/szurubooru" \ - org.opencontainers.image.documentation="https://github.com/rr-/szurubooru/blob/${SOURCE_COMMIT}/doc/INSTALL.md" \ - org.opencontainers.image.created="${BUILD_DATE}" \ - org.opencontainers.image.source="https://github.com/rr-/szurubooru" \ - org.opencontainers.image.revision="${SOURCE_COMMIT}" \ - org.opencontainers.image.licenses="GPL-3.0" diff --git a/client/docker-start.sh b/client/docker-start.sh deleted file mode 100755 index 0b2bec8..0000000 --- a/client/docker-start.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/dumb-init /bin/sh - -# Integrate environment variables -sed -i "s|__BACKEND__|${BACKEND_HOST}|" \ - /etc/nginx/nginx.conf -sed -i "s|__BASEURL__|${BASE_URL:-/}|g" \ - /var/www/index.htm \ - /var/www/manifest.json - -# Start server -exec nginx diff --git a/client/nginx.conf.docker b/client/nginx.conf.docker deleted file mode 100644 index 98c18b3..0000000 --- a/client/nginx.conf.docker +++ /dev/null @@ -1,101 +0,0 @@ -worker_processes 1; -user nginx; - -error_log /dev/stderr warn; -pid /var/run/nginx.pid; - -events { - worker_connections 1024; -} - -http { - include /etc/nginx/mime.types; - default_type application/octet-stream; - - log_format main '$remote_addr -> $request [$status] - ' - 'referer: $http_referer $http_x_forwarded_for'; - access_log /dev/stdout main; - - server_tokens off; - keepalive_timeout 65; - - upstream backend { - server __BACKEND__:6666; - } - - server { - listen 80 default_server; - - location ~ ^/api$ { - return 302 /api/; - } - - location ~ ^/api/(.*)$ { - tcp_nodelay on; - - add_header 'Access-Control-Allow-Origin' '*'; - if ($request_method = 'OPTIONS') { - add_header 'Access-Control-Allow-Methods' - 'GET, POST, PUT, DELETE, OPTIONS'; - add_header 'Access-Control-Allow-Headers' - 'Authorization, Content-Type'; - return 200; - } - - client_max_body_size 1073741824; - - gzip on; - gzip_comp_level 3; - gzip_min_length 20; - gzip_proxied expired no-cache no-store private auth; - gzip_types text/plain application/json; - - if ($request_uri ~* "/api/(.*)") { - proxy_pass http://backend/$1; - } - - error_page 500 502 503 504 @badproxy; - } - - location /data/ { - rewrite ^/data/(.*) /$1 break; - root /data; - - sendfile on; - tcp_nopush on; - tcp_nodelay on; - - error_page 403 @unauthorized; - error_page 404 @notfound; - } - - location / { - root /var/www; - try_files $uri /index.htm; - - sendfile on; - tcp_nopush on; - tcp_nodelay on; - - gzip_static on; - gzip_proxied expired no-cache no-store private auth; - } - - location @unauthorized { - return 403 "Unauthorized"; - default_type text/plain; - } - - location @notfound { - return 404 "Not Found"; - default_type text/plain; - } - - location @badproxy { - return 502 "Failed to connect to szurubooru REST API"; - default_type text/plain; - } - } -} - -daemon off; |