unified docker image

This commit is contained in:
Alberto Xamin 2020-11-24 14:24:09 +01:00
parent 68ba68a871
commit 2f1fed662d
No known key found for this signature in database
GPG Key ID: 4F026F48309500A2
4 changed files with 19 additions and 4 deletions

View File

@ -7,6 +7,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build the Unified Docker image
run: docker build . --file Dockerfile --tag albertoxamin/bang:latest
- name: Build the Backend Docker image
run: cd backend;docker build . --file Dockerfile --tag albertoxamin/bang-backend:latest
- uses: actions/checkout@v2
@ -14,5 +16,5 @@ jobs:
run: cd frontend;docker build . --file Dockerfile --tag albertoxamin/bang-frontend:latest
- name: Log into registry
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
- name: Push iamges
run: docker push albertoxamin/bang-backend:latest; docker push albertoxamin/bang-frontend:latest
- name: Push images
run: docker push albertoxamin/bang:latest; docker push albertoxamin/bang-backend:latest; docker push albertoxamin/bang-frontend:latest

11
Dockerfile Normal file
View File

@ -0,0 +1,11 @@
FROM node:lts-alpine as builder
COPY ./frontend .
RUN npm install
RUN npm run build
FROM python:3.7-slim-stretch
COPY --from=builder ./dist /dist/
COPY ./backend /dist/
WORKDIR /dist
RUN pip install -r requirements.txt
EXPOSE 5001
ENTRYPOINT ["python", "/dist/__init__.py"]

View File

@ -8,7 +8,9 @@ from players import Player
sio = socketio.Server(cors_allowed_origins="*")
app = socketio.WSGIApp(sio, static_files={
'/': {'content_type': 'text/html', 'filename': 'index.html'}
'/': {'content_type': 'text/html', 'filename': 'index.html'},
'/css': './css',
'/js': './js',
})
games: List[Game] = []

View File

@ -5,7 +5,7 @@ Vue.config.productionTip = false
import VueSocketIO from 'vue-socket.io'
Vue.use(new VueSocketIO({
debug: Vue.config.devtools,
connection: Vue.config.devtools?'http://localhost:5001':'http://bang.xamin.it:5001',
connection: Vue.config.devtools ? 'http://localhost:5001' : window.location.origin,
}))
new Vue({