diff --git a/Dockerfile b/Dockerfile index 5003311..80fd412 100644 --- a/Dockerfile +++ b/Dockerfile @@ -71,4 +71,7 @@ COPY --from=builder --chown=nobody:root /app/priv /app/priv USER nobody +EXPOSE 8080 +EXPOSE 34355 + CMD /app/bin/chessh eval "Chessh.Release.migrate" && /app/bin/chessh start diff --git a/deploy.sh b/deploy.sh index cc23dde..51d49cf 100755 --- a/deploy.sh +++ b/deploy.sh @@ -4,7 +4,8 @@ datestamp=$(date +%Y%m%d-%H%M) env_file=.env.prod project_name=chessh port=8080 -host=127.0.0.1 +ssh_port=34355 +host=0.0.0.0 container_names=("chessh-database" "chessh-server" "chessh-frontend") @@ -39,6 +40,7 @@ docker run \ --env-file $env_file \ --network $project_name \ --name $project_name-server \ + --publish "${host}:${ssh_port}:${ssh_port}/tcp" \ --net-alias server \ chessh/server diff --git a/front/Dockerfile b/front/Dockerfile index b8de217..03a4a4e 100644 --- a/front/Dockerfile +++ b/front/Dockerfile @@ -20,7 +20,7 @@ RUN npm run build FROM nginx:alpine EXPOSE 80 -COPY nginx.conf /etc/nginx/conf.d/ +COPY nginx.conf /etc/nginx/conf.d/default.conf COPY --from=build /usr/app/build /usr/share/nginx/html RUN chown -R nginx:nginx /usr/share/nginx/html diff --git a/front/nginx.conf b/front/nginx.conf index e58185e..c87e262 100644 --- a/front/nginx.conf +++ b/front/nginx.conf @@ -1,3 +1,7 @@ +upstream server { + server server:8080; +} + server { listen 80; @@ -7,7 +11,8 @@ server { try_files $uri $uri/ /index.html; } - location ~ ^/api(/.*|$) { - proxy_pass http://server:8080/$1; + location /api/ { + proxy_set_header Host $host; + proxy_pass http://server/; } } diff --git a/front/src/root.jsx b/front/src/root.jsx index b5f4648..5ba629a 100644 --- a/front/src/root.jsx +++ b/front/src/root.jsx @@ -5,8 +5,7 @@ import logo from "./assets/chessh_sm.svg"; import { useAuthContext } from "./context/auth_context"; export const Root = () => { - const { signedIn, setUserId, setSignedIn, setSessionOver, signOut } = - useAuthContext(); + const { signedIn, signOut } = useAuthContext(); return ( <>