Flask App Build Subprocess

I am using a build of an open source software in a flask application to run a subprocess to. I have a build directory inside of my project and the subprocess I am running is in the software inside of that build folder. How do I make sure when I deploy to railway it can use that build? Here is my GitHub Repo for more context! 👇🏼 https://github.com/nworbdier/waypoints-x-api Railway Project ID: b58c8c62-a918-47e9-a602-c1eddd8a8afa
Solution:
Update for anyone that might read this later. I set up my Dockerfile to this and it worked!! Thanks so much again @Brody G.O.A.T. ``` Use x86_64 architecture to match Railway’s environment FROM --platform=linux/amd64 python:3.12-slim ...
Jump to solution
20 Replies
Percy
Percy4w ago
Project ID: b58c8c62-a918-47e9-a602-c1eddd8a8afa
Brody
Brody4w ago
@rwbcodes that repo is private
rwbcodes
rwbcodesOP4w ago
Hi Brody! Here is that repo not private! https://github.com/nworbdier/waypoints-x-api I used a dockerfile to build a version of the gpsbabel (gpsbabel-linux) that is linux/ubuntu (does it have to be that to work on railway)? When i run the api and hit the endpoints with just the gpsbabel it works perfectly but when i deploy to railway and use that binary it doesn't work! Then if i use the gpsbabel-linux on Railway it also doesn't work.
GitHub
GitHub - nworbdier/waypoints-x-api
Contribute to nworbdier/waypoints-x-api development by creating an account on GitHub.
rwbcodes
rwbcodesOP4w ago
When i use gpsbabel i get a response of {"error":"[Errno 8] Exec format error: './bin/gpsbabel'"} When I use gpsbabel-linux I get a {"error":"Failed to extract waypoints."}
No description
Brody
Brody4w ago
i dont see a dockerfile?
rwbcodes
rwbcodesOP4w ago
I copied it in from another project so it didn't have to run every time! FROM --platform=linux/amd64 ubuntu:22.04 RUN apt-get update && apt-get install -y --no-install-recommends \ # Basic build and test tools g++ \ make \ git \ valgrind \ expat \ libxml2-utils \ bear \ cmake \ ninja-build \ clazy \ clang-tidy \ jq \ curl \ ca-certificates \ # Alternative compiler clang \ # Packages needed to build documents fop \ xsltproc \ docbook-xml \ docbook5-xml \ docbook-xsl \ docbook-xsl-ns \ libavalon-framework-java \ jing \ # Packages with libraries needed by gpsbabel libusb-1.0-0-dev \ pkg-config \ libudev-dev \ # Packages with qt used by gpsbabel qtbase5-dev \ qttools5-dev \ qttools5-dev-tools \ qttranslations5-l10n \ qtwebengine5-dev \ libqt5serialport5-dev \ # Additional qt6 packages qt6-base-dev \ libqt6core5compat6-dev \ libqt6opengl6-dev \ libqt6serialport6-dev \ libqt6webenginecore6-bin \ libgl-dev \ libopengl-dev \ libvulkan-dev \ libx11-xcb-dev \ libxkbcommon-dev \ qt6-l10n-tools \ qt6-tools-dev \ qt6-tools-dev-tools \ qt6-translations-l10n \ qt6-webengine-dev \ qt6-webengine-dev-tools \ qt6-wayland \ && apt-get clean && rm -rf /var/lib/apt/lists/* RUN git clone https://github.com/gpsbabel/gpsbabel.git WORKDIR /gpsbabel RUN mkdir build && cd build && cmake .. && make RUN mkdir -p /gpsbabel-docker/bin RUN cp build/gpsbabel /gpsbabel-docker/bin/ ENTRYPOINT ["/gpsbabel-docker/bin/gpsbabel"]
Brody
Brody4w ago
right but this project will need a dockerfile to install any system libs that gpsbabel might need
rwbcodes
rwbcodesOP4w ago
gotcha! I am a inexperienced and had to use ai to help me with this as i had 0 clue how to do it. My api project will need the attached dockerfile?
Brody
Brody4w ago
correct, minus the build stuff
rwbcodes
rwbcodesOP4w ago
Excuse my dumb questions. So do you mean just this?
FROM --platform=linux/amd64 ubuntu:22.04

RUN apt-get update && apt-get install -y --no-install-recommends \
# Basic build and test tools
g++ \
make \
git \
valgrind \
expat \
libxml2-utils \
bear \
cmake \
ninja-build \
clazy \
clang-tidy \
jq \
curl \
ca-certificates \
# Alternative compiler
clang \
# Packages needed to build documents
fop \
xsltproc \
docbook-xml \
docbook5-xml \
docbook-xsl \
docbook-xsl-ns \
libavalon-framework-java \
jing \
# Packages with libraries needed by gpsbabel
libusb-1.0-0-dev \
pkg-config \
libudev-dev \
# Packages with qt used by gpsbabel
qtbase5-dev \
qttools5-dev \
qttools5-dev-tools \
qttranslations5-l10n \
qtwebengine5-dev \
libqt5serialport5-dev \
# Additional qt6 packages
qt6-base-dev \
libqt6core5compat6-dev \
libqt6opengl6-dev \
libqt6serialport6-dev \
libqt6webenginecore6-bin \
libgl-dev \
libopengl-dev \
libvulkan-dev \
libx11-xcb-dev \
libxkbcommon-dev \
qt6-l10n-tools \
qt6-tools-dev \
qt6-tools-dev-tools \
qt6-translations-l10n \
qt6-webengine-dev \
qt6-webengine-dev-tools \
qt6-wayland \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
FROM --platform=linux/amd64 ubuntu:22.04

RUN apt-get update && apt-get install -y --no-install-recommends \
# Basic build and test tools
g++ \
make \
git \
valgrind \
expat \
libxml2-utils \
bear \
cmake \
ninja-build \
clazy \
clang-tidy \
jq \
curl \
ca-certificates \
# Alternative compiler
clang \
# Packages needed to build documents
fop \
xsltproc \
docbook-xml \
docbook5-xml \
docbook-xsl \
docbook-xsl-ns \
libavalon-framework-java \
jing \
# Packages with libraries needed by gpsbabel
libusb-1.0-0-dev \
pkg-config \
libudev-dev \
# Packages with qt used by gpsbabel
qtbase5-dev \
qttools5-dev \
qttools5-dev-tools \
qttranslations5-l10n \
qtwebengine5-dev \
libqt5serialport5-dev \
# Additional qt6 packages
qt6-base-dev \
libqt6core5compat6-dev \
libqt6opengl6-dev \
libqt6serialport6-dev \
libqt6webenginecore6-bin \
libgl-dev \
libopengl-dev \
libvulkan-dev \
libx11-xcb-dev \
libxkbcommon-dev \
qt6-l10n-tools \
qt6-tools-dev \
qt6-tools-dev-tools \
qt6-translations-l10n \
qt6-webengine-dev \
qt6-webengine-dev-tools \
qt6-wayland \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
Brody
Brody4w ago
please wrap these in triple backticks you will need more than that, you need to use the python image, install from requirements.txt, and start your app, etc
rwbcodes
rwbcodesOP4w ago
So basically run my entire project through the dockerfile?
Brody
Brody4w ago
maybe, that sentence does not make technical sense
rwbcodes
rwbcodesOP4w ago
Where my lack of knowledge shines through. I think I know what you mean just not articulating it!
Brody
Brody4w ago
fair enough, talk with chat gpt about it, it will be able to help you better than i could since this isnt railway specific
rwbcodes
rwbcodesOP4w ago
Gotcha! What version does my gpsbabel build need to be? I am working from a Macbook so it obviously can't use the cmake .. and make from this machine correct?
Brody
Brody4w ago
the binary you already build for amd64 is fine
rwbcodes
rwbcodesOP4w ago
Perfect! Thank you!!
Solution
rwbcodes
rwbcodes4w ago
Update for anyone that might read this later. I set up my Dockerfile to this and it worked!! Thanks so much again @Brody G.O.A.T.
# Use x86_64 architecture to match Railway’s environment
FROM --platform=linux/amd64 python:3.12-slim

# Set the working directory
WORKDIR /app

# Copy the requirements file
COPY requirements.txt .

# Install necessary packages
RUN apt-get update && apt-get install -y --no-install-recommends \
# Basic build and test tools
g++ \
make \
git \
valgrind \
expat \
libxml2-utils \
bear \
cmake \
ninja-build \
clazy \
clang-tidy \
jq \
curl \
ca-certificates \
# Alternative compiler
clang \
# Packages needed to build documents
fop \
xsltproc \
docbook-xml \
docbook5-xml \
docbook-xsl \
docbook-xsl-ns \
libavalon-framework-java \
jing \
# Packages with libraries needed by gpsbabel
libusb-1.0-0-dev \
pkg-config \
libudev-dev \
# Packages with qt used by gpsbabel
qtbase5-dev \
qttools5-dev \
qttools5-dev-tools \
qttranslations5-l10n \
qtwebengine5-dev \
libqt5serialport5-dev \
# Additional qt6 packages
qt6-base-dev \
libqt6core5compat6-dev \
libqt6opengl6-dev \
libqt6serialport6-dev \
libqt6webenginecore6-bin \
libgl-dev \
libopengl-dev \
libvulkan-dev \
libx11-xcb-dev \
libxkbcommon-dev \
qt6-l10n-tools \
qt6-tools-dev \
qt6-tools-dev-tools \
qt6-translations-l10n \
qt6-webengine-dev \
qt6-webengine-dev-tools \
qt6-wayland \
&& apt-get clean && rm -rf /var/lib/apt/lists/*

# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Copy the rest of your application code
COPY . .

# Set the environment variable for the port
ENV PORT=5000

# Command to run your application using Gunicorn
CMD gunicorn api:app --bind 0.0.0.0:$PORT # Ensure your Flask app is named 'app' in api.py
# Use x86_64 architecture to match Railway’s environment
FROM --platform=linux/amd64 python:3.12-slim

# Set the working directory
WORKDIR /app

# Copy the requirements file
COPY requirements.txt .

# Install necessary packages
RUN apt-get update && apt-get install -y --no-install-recommends \
# Basic build and test tools
g++ \
make \
git \
valgrind \
expat \
libxml2-utils \
bear \
cmake \
ninja-build \
clazy \
clang-tidy \
jq \
curl \
ca-certificates \
# Alternative compiler
clang \
# Packages needed to build documents
fop \
xsltproc \
docbook-xml \
docbook5-xml \
docbook-xsl \
docbook-xsl-ns \
libavalon-framework-java \
jing \
# Packages with libraries needed by gpsbabel
libusb-1.0-0-dev \
pkg-config \
libudev-dev \
# Packages with qt used by gpsbabel
qtbase5-dev \
qttools5-dev \
qttools5-dev-tools \
qttranslations5-l10n \
qtwebengine5-dev \
libqt5serialport5-dev \
# Additional qt6 packages
qt6-base-dev \
libqt6core5compat6-dev \
libqt6opengl6-dev \
libqt6serialport6-dev \
libqt6webenginecore6-bin \
libgl-dev \
libopengl-dev \
libvulkan-dev \
libx11-xcb-dev \
libxkbcommon-dev \
qt6-l10n-tools \
qt6-tools-dev \
qt6-tools-dev-tools \
qt6-translations-l10n \
qt6-webengine-dev \
qt6-webengine-dev-tools \
qt6-wayland \
&& apt-get clean && rm -rf /var/lib/apt/lists/*

# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Copy the rest of your application code
COPY . .

# Set the environment variable for the port
ENV PORT=5000

# Command to run your application using Gunicorn
CMD gunicorn api:app --bind 0.0.0.0:$PORT # Ensure your Flask app is named 'app' in api.py
Brody
Brody4w ago
happy to help!
Want results from more Discord servers?
Add your server