Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 5 additions & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ RUN --mount=type=cache,id=pnpm,target=/pnpm/store \
pnpm install --frozen-lockfile --ignore-scripts

# Copy necessary build configurations
COPY vite.config.ts index.html tsconfig.json tsconfig.app.json tsconfig.node.json /website/
COPY vite.config.ts index.html tsconfig.json tsconfig.app.json tsconfig.node.json docker/nginx.conf /website/
COPY public /website/public
COPY src /website/src

Expand All @@ -24,13 +24,16 @@ RUN pnpm run build

FROM nginxinc/nginx-unprivileged:stable-alpine-perl

ENV NGINX_ENTRYPOINT_QUIET_LOGS=1

COPY --from=build /website/dist /usr/share/nginx/html
COPY --from=build /website/nginx.conf /etc/nginx/conf.d/default.conf

EXPOSE 8080

CMD ["nginx", "-g", "daemon off;"]

HEALTHCHECK --interval=5m --timeout=3s CMD ["curl", "-f" , "http://localhost:8080/", "||", "exit 1"]
HEALTHCHECK --interval=5m --timeout=3s CMD curl -fsS http://localhost:8080/ || exit 1

LABEL org.opencontainers.image.title="Chapter-Website"
LABEL org.opencontainers.image.description="ACM @ UC Merced's website"
Expand Down
48 changes: 48 additions & 0 deletions docker/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
map $uri $cache_control {
default "public, max-age=86400";
~^/assets/ "public, max-age=31536000, immutable";
~^/workbox-[^/]+\.js$ "public, max-age=31536000, immutable";
/index.html "no-cache";
/sw.js "no-cache";
/registerSW.js "no-cache";
}

server {
listen 8080;
listen [::]:8080;

root /usr/share/nginx/html;
index index.html;

charset utf-8;
server_tokens off;
absolute_redirect off;

gzip on;
gzip_vary on;
gzip_comp_level 6;
gzip_min_length 1024;
gzip_static on;
gzip_types text/css text/plain text/xml application/javascript application/json
application/manifest+json image/svg+xml;

add_header Cache-Control $cache_control always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header X-Frame-Options "SAMEORIGIN" always;

location = /site.webmanifest {
types { }
default_type application/manifest+json;
}

location ^~ /assets/ {
try_files $uri =404;
}

location / {
try_files $uri $uri/ /index.html;
}

include /etc/nginx/extra-conf.d/*.conf;
}