Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: combine frontend and backend into single container #1512

Closed
wants to merge 2 commits into from
Closed
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
5 changes: 4 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@
!.postcssrc.js
!babel.config.js
!vue.config.js
!docker/nginx.conf
!docker

!backend/src
!backend/package*
13 changes: 12 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,22 @@ ARG VUE_APP_NODE_URL
ARG VUE_APP_MDW_URL
ARG VUE_APP_EXPLORER_URL
ARG VUE_APP_COMPILER_URL
ARG VUE_APP_BACKEND_URL
ARG VUE_APP_BACKEND_URL /

# TODO: remove legacy openssl after updating @vue/cli
RUN NODE_OPTIONS=--openssl-legacy-provider npm run build

FROM nginx:1.24-alpine
RUN apk add nodejs npm

WORKDIR /backend
COPY backend/package*.json ./
RUN npm ci --omit=dev
COPY backend/src src

COPY docker/nginx.conf /etc/nginx/nginx.conf
COPY docker/entrypoint.sh /aepp-base-entrypoint.sh

COPY --from=aepp-aepp-base-build /app/dist /usr/share/nginx/html

CMD ["/aepp-base-entrypoint.sh"]
11 changes: 0 additions & 11 deletions backend/Dockerfile

This file was deleted.

6 changes: 0 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,7 @@ services:
image: aepp-base
build:
context: .
args:
VUE_APP_BACKEND_URL: http://localhost:3079
ports: ["3080:80"]
backend:
image: aepp-base-backend
build: backend
ports: ["3079:80"]
compiler:
image: aeternity/aesophia_http:v6.1.0
hostname: compiler
Expand Down
10 changes: 10 additions & 0 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh

cd /backend
npm start &

# source https://github.com/nginxinc/docker-nginx/blob/3aac9b12463cf031037f7e21b3857f9a4bec3f28/stable/alpine-slim/Dockerfile#L122
/docker-entrypoint.sh nginx -g "daemon off;" &

wait -n
exit $?
4 changes: 4 additions & 0 deletions docker/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ http {
location /robots.txt {
}

location /socket.io/ {
proxy_pass http://localhost:8079/socket.io/;
}

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