部署到docker中的wildfly根目录

时间:2020-09-04 01:39:46

标签: java docker wildfly

Dockerfile

import sys
from PyQt5.QtGui import QKeySequence
from PyQt5.QtWidgets import QApplication, QLabel, QMainWindow, QShortcut
from PyQt5.QtCore import Qt


# Subclass QMainWindow to customise your application's main window
class MainWindow(QMainWindow):
    isfullscreen = False
    def __init__(self, *args, **kwargs):
        super(MainWindow, self).__init__(*args, **kwargs)

        self.setWindowTitle("Hello fullscreen world")

        self._flags = self.windowFlags()
        self._geometry = ((self.screen().size().width() / 2) - (self.width() / 2),
                          (self.screen().size().height() / 2) - (self.height() / 2), 600, 400)

        self.setGeometry(*self._geometry)

        label = QLabel("Hello fullscreen world")


        # The `Qt` namespace has a lot of attributes to customise
        # widgets. See: http://doc.qt.io/qt-5/qt.html
        label.setAlignment(Qt.AlignCenter)

        # Set the central widget of the Window. Widget will expand
        # to take up all the space in the window by default.
        self.setCentralWidget(label)

        self.shortcut_close_window = QShortcut(QKeySequence('F11'), self)
        self.shortcut_close_window.activated.connect(self.goShowFullScreen)
        self._geometry = self.geometry()

    def goShowFullScreen(self):
        if not self.isfullscreen:
            self.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint)
            self.setGeometry(self.screen().geometry())
            self.show()
            self.isfullscreen = True
        else:
            self.setWindowFlags(self.windowFlags() & ~Qt.WindowStaysOnTopHint)
            self.setWindowFlags(self.windowFlags() & ~Qt.FramelessWindowHint)
            self.setGeometry(self._geometry)
            self.show()
            self.isfullscreen = False


app = QApplication(sys.argv)

window = MainWindow()
window.show()

app.exec_()

Docker-compose.yml

FROM jboss/wildfly
COPY target/TimeTable-1.0-SNAPSHOT.war /opt/jboss/wildfly/standalone/deployments/

webapp / WEB-INF / jboss-config.xml

version: '3'

services:
  wildfly:
    image: jboss/wildfly
    container_name: wildfly
    ports:
      - "8080:8080"
      - "9990:9990"
  timetable:
    build: .
    depends_on:
      - wildfly

如果我自己动手部署到主机上,那么一切都会按预期运行,并且在根页面上,我会看到<jboss-web xmlns="http://www.jboss.com/xml/ns/javaee" version="8.0"> <context-root>/</context-root> </jboss-web> 。但是,当我将其部署到docker时,index.xhtml会显示默认的wildfly欢迎页面。在docker的日志中,我看到localhost:8080/,但仍然没有任何变化

1 个答案:

答案 0 :(得分:0)

文件名为jboss-web.xml。我有与您不同的名称空间,但我相信它只是文件名。我有:

<?xml version="1.0" encoding="UTF-8"?>
<jboss-web version="10.0"
           xmlns="http://www.jboss.com/xml/ns/javaee"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee http://www.jboss.org/j2ee/schema/jboss-web_10_0.xsd">

    <context-root>/</context-root>
</jboss-web>