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