доза: условие гонки в докере строит, тянет mfc42.dll автоматически
This commit is contained in:
parent
1c79edcde7
commit
13bf157135
6 changed files with 51 additions and 33 deletions
|
|
@ -1,41 +1,43 @@
|
|||
#check=skip=JSONArgsRecommended
|
||||
FROM debian:12-slim AS builder
|
||||
|
||||
FROM debian:13-slim AS builder
|
||||
RUN apt-get update && DEBIAN_FRONTEND=noninteracive apt-get install -y \
|
||||
--no-install-recommends cmake g++-mingw-w64-i686-posix g++ make && \
|
||||
apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
apt-get clean && rm -rf /var/lib/apt/lists/*;
|
||||
|
||||
WORKDIR /build
|
||||
COPY . .
|
||||
RUN g++ -o healthcheck -I./include ./app/healthcheck.cpp
|
||||
COPY app app
|
||||
COPY include include
|
||||
COPY src src
|
||||
COPY CMakeLists.txt .
|
||||
|
||||
RUN g++ -o healthcheck -I./include ./app/healthcheck.cpp;
|
||||
|
||||
RUN --mount=type=cache,target=cmake-build cmake -B cmake-build \
|
||||
-DCMAKE_CXX_COMPILER=i686-w64-mingw32-g++ && cmake --build cmake-build -j$(nproc) && \
|
||||
cp cmake-build/promt-puppy.exe .
|
||||
cp cmake-build/promt-puppy.exe .;
|
||||
|
||||
FROM debian:12-slim AS runner
|
||||
|
||||
FROM debian:13-slim AS runner
|
||||
ENV WINEPREFIX=/wineprefix \
|
||||
DEBIAN_FRONTEND=noninteracive
|
||||
XDG_RUNTIME_DIR=/tmp/ \
|
||||
DEBIAN_FRONTEND=noninteracive \
|
||||
WINEDEBUG=-all
|
||||
|
||||
RUN dpkg --add-architecture i386 && apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
wine wine64 wine32:i386 && \
|
||||
apt-get clean && rm -rf /var/lib/apt/lists/* && \
|
||||
wineboot -i && echo "Sleeping for 15 seconds..." && sleep 15 && \
|
||||
mkdir /tmpfs && ln -sf /tmpfs $WINEPREFIX/drive_c/tmpfs
|
||||
|
||||
mkdir -p /tmpfs $WINEPREFIX/drive_c && ln -sf /tmpfs $WINEPREFIX/drive_c/tmpfs;
|
||||
|
||||
COPY build/ $WINEPREFIX/drive_c
|
||||
RUN wine regedit $WINEPREFIX/drive_c/registry.reg && \
|
||||
echo "Sleeping for 15 seconds" && sleep 15
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=builder /build/promt-puppy.exe /build/healthcheck .
|
||||
|
||||
HEALTHCHECK CMD ./healthcheck
|
||||
HEALTHCHECK CMD ./healthcheck;
|
||||
|
||||
EXPOSE 80/tcp
|
||||
VOLUME /cache
|
||||
|
||||
ENV WINEDEBUG=-all
|
||||
|
||||
CMD exec wine promt-puppy.exe
|
||||
COPY docker-entrypoint.sh /entrypoint.sh
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
|
|
|||
|
|
@ -142,7 +142,8 @@ class WebServer {
|
|||
|
||||
public:
|
||||
WebServer() {
|
||||
if (!std::filesystem::exists(TMP_FOLDER)) std::filesystem::create_directory(TMP_FOLDER);
|
||||
if (!std::filesystem::exists(TMP_FOLDER))
|
||||
std::filesystem::create_directory(TMP_FOLDER);
|
||||
|
||||
m_svr.Post("/translate", [this](const httplib::Request &req, httplib::Response &res) {
|
||||
TranslateHandler(req, res);
|
||||
|
|
@ -159,6 +160,7 @@ class WebServer {
|
|||
}
|
||||
|
||||
void listen(const char *host = "0.0.0.0", unsigned short port = 80) {
|
||||
print("Started!");
|
||||
m_svr.listen(host, port);
|
||||
}
|
||||
|
||||
|
|
|
|||
5
puppy/docker-entrypoint.sh
Executable file
5
puppy/docker-entrypoint.sh
Executable file
|
|
@ -0,0 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
wineboot -i
|
||||
wine regedit $WINEPREFIX/drive_c/registry.reg
|
||||
exec wine /app/promt-puppy.exe
|
||||
|
|
@ -1,15 +1,23 @@
|
|||
#!/bin/bash -e
|
||||
# shellcheck disable=SC1091
|
||||
|
||||
cd "$(basename "$(basename "$(readlink "$0")")")"
|
||||
|
||||
SCRIPT_DIR="$(dirname "$(dirname "$(readlink -e "$0")")")"
|
||||
SSH_HOST="${1:?Missing SSH host}"
|
||||
|
||||
mkdir -p build/{"Program Files (x86)/Common Files",ProgramData}
|
||||
# scp ./scripts/dump_registry.ps1 "$SSH_HOST:"
|
||||
# ssh "$SSH_HOST" "powershell .\dump_registry.ps1"
|
||||
scp "$SCRIPT_DIR/scripts/dump_registry.ps1" "$SSH_HOST:"
|
||||
ssh "$SSH_HOST" "powershell .\dump_registry.ps1"
|
||||
scp "$SSH_HOST:promt-registry.reg" build/registry.reg
|
||||
ssh "$SSH_HOST" powershell -c 'rm promt-registry.reg'
|
||||
|
||||
scp -r "$SSH_HOST:/Program Files (x86)/Common Files/PROject MT" "./build/Program Files (x86)/Common Files/PROject MT"
|
||||
scp -r "$SSH_HOST:/Program Files (x86)/PRMT6" "./build/Program Files (x86)/PRMT6"
|
||||
scp -r "$SSH_HOST:/ProgramData/PROject MT" "./build/ProgramData/PROject MT"
|
||||
scp -r "$SSH_HOST:/Program Files (x86)/Common Files/PROject MT" "$SCRIPT_DIR/build/Program Files (x86)/Common Files/PROject MT"
|
||||
scp -r "$SSH_HOST:/Program Files (x86)/PRMT6" "$SCRIPT_DIR/build/Program Files (x86)/PRMT6"
|
||||
scp -r "$SSH_HOST:/ProgramData/PROject MT" "$SCRIPT_DIR/build/ProgramData/PROject MT"
|
||||
|
||||
export WINETRICKS_LIB=1
|
||||
. winetricks 2>/dev/null
|
||||
|
||||
winetricks_init
|
||||
winetricks_vcrun6_helper
|
||||
w_try_cabextract "${W_CACHE}"/vcrun6/vcredist.exe -d "$SCRIPT_DIR/build/windows/" -F "mfc42*.dll"
|
||||
mkdir -p "$SCRIPT_DIR/build/windows/system32"
|
||||
|
|
|
|||
|
|
@ -1,15 +1,16 @@
|
|||
#include "COMWrapper.hpp"
|
||||
|
||||
#include <cstdio>
|
||||
#include <stdexcept>
|
||||
#include <windows.h>
|
||||
#include <comdef.h>
|
||||
|
||||
void COMWrapper::Raise(const HRESULT hr, const char *const ctx) const {
|
||||
if (hr != 0) {
|
||||
char msg[128];
|
||||
snprintf(msg, 128, "[%s] Non-zero HRESULT value: 0x%x at: %s\n", classname(), hr, ctx);
|
||||
printf(msg);
|
||||
throw std::runtime_error(msg);
|
||||
char msg[1024];
|
||||
_com_error err(hr);
|
||||
snprintf(msg, 1024, "[%s] Error: %s (0x%lx) at: %s\n", classname(), err.ErrorMessage(), hr, ctx);
|
||||
printf("%s\n", msg);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue