Skip to content

Commit

Permalink
Improve front-end setup to match that of GHS
Browse files Browse the repository at this point in the history
  • Loading branch information
dabico committed Jun 7, 2024
1 parent 4bbc9f2 commit 189d602
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 41 deletions.
2 changes: 0 additions & 2 deletions deployment/.env.template
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,3 @@ SERVER_MAIL_PASS=$SERVER_MAIL_PASS
SERVER_SECURITY_USER=$SERVER_SECURITY_USER
SERVER_SECURITY_PASS=$SERVER_SECURITY_PASS
SERVER_JWT_SECRET=$SERVER_JWT_SECRET

WEBSITE_PORT=$WEBSITE_PORT
17 changes: 9 additions & 8 deletions deployment/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ services:
SERVER_SECURITY_USER: ${SERVER_SECURITY_USER}
SERVER_SECURITY_PASS: ${SERVER_SECURITY_PASS}
SERVER_JWT_SECRET: ${SERVER_JWT_SECRET}
WEBSITE_URL: http://localhost:${WEBSITE_PORT}
WEBSITE_URL: http://localhost:7031
volumes:
- ./logs:/logs
- server-tmp:/tmp
Expand All @@ -98,25 +98,26 @@ services:
restart_policy:
condition: on-failure
max_attempts: 3
ports:
- "${SERVER_PORT}:${SERVER_PORT}"
ports: [ "48002:8080" ]

dl4se-website:
container_name: dl4se-website
image: seart/dl4se-website:latest
build:
context: ../
dockerfile: deployment/website/Dockerfile
args:
WEBSITE_PORT: ${WEBSITE_PORT}
networks:
- default
restart: always
environment:
BASE_URL: http://localhost:48002
depends_on:
dl4se-server:
condition: service_healthy
ports:
- "${WEBSITE_PORT}:80"
deploy:
restart_policy:
condition: on-failure
max_attempts: 3
ports: [ "7031:80" ]

volumes:
data:
Expand Down
38 changes: 23 additions & 15 deletions deployment/website/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
FROM node:18.18.2-alpine AS install
ARG WEBSITE_PORT
ARG SERVER_URL
COPY ./dl4se-website/package*.json ./
RUN npm install
FROM node:18.20.3-alpine AS build

COPY ./dl4se-website .

FROM install AS build
ARG WEBSITE_PORT
ARG SERVER_URL
ARG NODE_ENV=production
RUN apk update --quiet && \
apk add --no-cache --quiet gettext && \
envsubst < .env.template > .env && \
npm run build
COPY <<-EOF .env
VUE_APP_API_BASE_URL=http://localhost:8080/api
EOF

RUN npm ci && npm run build

FROM nginx:1.26.0-alpine-slim AS production

ENV TZ=UTC

FROM nginx:1.25.3-alpine AS production
COPY --from=build /dist /usr/share/nginx/html
COPY ./nginx/nginx.conf /etc/nginx/conf.d/default.conf
COPY ./nginx/nginx.conf.template /etc/nginx/templates/default.conf.template

ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["nginx", "-g", "daemon off;"]

EXPOSE 80 8000

HEALTHCHECK \
--start-period=10s \
--interval=60s \
--timeout=30s \
--retries=5 \
CMD nc -z 127.0.0.1 80 || exit 1
16 changes: 0 additions & 16 deletions nginx/nginx.conf

This file was deleted.

19 changes: 19 additions & 0 deletions nginx/nginx.conf.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
server {
listen 80;
server_name localhost;

location / {
root /usr/share/nginx/html;
index index.html;
try_files $uri $uri/ /index.html;
sub_filter_once off;
sub_filter_types application/javascript;
sub_filter "http://localhost:8080" "${BASE_URL}";
}
}

server {
listen 8000;
server_name localhost;
stub_status on;
}

0 comments on commit 189d602

Please sign in to comment.