Skip to content

Commit

Permalink
chore: combine frontend and backend into single container
Browse files Browse the repository at this point in the history
  • Loading branch information
davidyuk committed Aug 12, 2023
1 parent fe34dcc commit 5095888
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 19 deletions.
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*
11 changes: 10 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,20 @@ 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/run-backend.sh /docker-entrypoint.d

COPY --from=aepp-aepp-base-build /app/dist /usr/share/nginx/html
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
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
5 changes: 5 additions & 0 deletions docker/run-backend.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
set -e

cd /backend
npm start &

0 comments on commit 5095888

Please sign in to comment.