a year ago
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
21 Replies
a year ago
@rwbcodes that repo is private
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.
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."}

a year ago
i dont see a dockerfile?
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"]
a year ago
right but this project will need a dockerfile to install any system libs that gpsbabel might need
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?
a year ago
correct, minus the build stuff
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/*a year ago
please wrap these in triple backticks
a year ago
you will need more than that, you need to use the python image, install from requirements.txt, and start your app, etc
a year ago
maybe, that sentence does not make technical sense
Where my lack of knowledge shines through.
I think I know what you mean just not articulating it!
a year 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
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?
a year ago
the binary you already build for amd64 is fine
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.pya year ago
happy to help!