3 months ago
At our company we are pushing our docker images to a repo on artifactory. I did not figure out how to pull a docker image from artifactory to railway. HOw can I do that?
6 Replies
3 months ago
Unfortunately, Railway only supports images from Docker Hub, GHCR, Quay.io, or GitLab Container Registry.
3 months ago
Can you tell us a little bit more about your company's usage of Docker Registries on Artifactory? What kind of volume are you using this at?
3 months ago
We are using Artifactory not just as a docker registry but as a place to put a variety of artifacts and package types. I am building integrations between our own SaaS Platform and 3rd party systems for customers of our SaaS platform. I thought deploying those integrations as a docker image would allow me to either deploy it to a PaaS Solution like railways or on-premises on a vm or other infrastructure that customers might have.
3 months ago
hey @chrbutt-droid
actually you might be able to get this working without a direct integration if you treat artifactory as a generic private registry
go into your service settings in railway and look for the Docker Image section or Private Registry settings depending on your view
you should be able to punch in your artifactory server url along with your username and a generated access token as the password
if railway struggles to auth with artifactory directly a solid workaround is to use a github action to handle the moving parts
basically you login to artifactory in the runner pull the image and then use the railway cli to deploy it
YAML
steps:
- name: Login to Artifactory
uses: docker/login-action@v2
with:
registry: artifactory.yourcompany.com
username: ${{ secrets.ARTIFACTORY_USER }}
password: ${{ secrets.ARTIFACTORY_TOKEN }}
- name: Deploy to Railway
run: |
npm i -g @railway/cli
railway up --service your-service-name
env:
RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }}
this way railway just receives the deployment and doesnt need to talk to artifactory itself
let us know if the generic registry settings work though usually thats cleaner
would you like me to find a specific example of an artifactory url structure that works with generic docker clients
anarchistmanifesto
hey @chrbutt-droidactually you might be able to get this working without a direct integration if you treat artifactory as a generic private registrygo into your service settings in railway and look for the Docker Image section or Private Registry settings depending on your viewyou should be able to punch in your artifactory server url along with your username and a generated access token as the passwordif railway struggles to auth with artifactory directly a solid workaround is to use a github action to handle the moving partsbasically you login to artifactory in the runner pull the image and then use the railway cli to deploy itYAMLsteps: - name: Login to Artifactory uses: docker/login-action@v2 with: registry: artifactory.yourcompany.com username: ${{ secrets.ARTIFACTORY_USER }} password: ${{ secrets.ARTIFACTORY_TOKEN }} - name: Deploy to Railway run: | npm i -g @railway/cli railway up --service your-service-name env: RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }}this way railway just receives the deployment and doesnt need to talk to artifactory itselflet us know if the generic registry settings work though usually thats cleanerwould you like me to find a specific example of an artifactory url structure that works with generic docker clients
3 months ago
Sorry but neither the full url to the image on artifactory is accepted by railway nor going via CI/CD pipeline works. The reason for the railway clis not to work is simply that the command 'railway up' is not pushing a docker image but rather compressing the content of your folder and uploading that to railway. Then railway is trying to build the code. In my case a dockerfile was inlcuded so railway tried to build image. Unfortunately the dockerfile includes a step to install a whl file from artifactory via poetry. Although I provided correct credentials for Artifactory the step failed with the message that connection to Artifactory was not successfull.
chrbutt-droid
Sorry but neither the full url to the image on artifactory is accepted by railway nor going via CI/CD pipeline works. The reason for the railway clis not to work is simply that the command 'railway up' is not pushing a docker image but rather compressing the content of your folder and uploading that to railway. Then railway is trying to build the code. In my case a dockerfile was inlcuded so railway tried to build image. Unfortunately the dockerfile includes a step to install a whl file from artifactory via poetry. Although I provided correct credentials for Artifactory the step failed with the message that connection to Artifactory was not successfull.
3 months ago
ah gotcha @chrbutt-droid yeah that makes sense now. railway up is basically just yeeting your local folder to their build server so it tries to build from source every time.
since you are stuck on the build phase because poetry cant auth with artifactory, the issue is likely that railway runtime variables are not available during the build process. the build environment is isolated.
you have two ways to solve this:
1. fix the build on railway
you need to pass your artifactory credentials as build args, not just environment variables.
go to your service settings in railway, scroll down to the Build section, and look for Docker Build Args. add your ARTIFACTORY_USER and ARTIFACTORY_TOKEN there.
then you need to make sure your Dockerfile actually accepts them. update your Dockerfile to look something like this near the top:
Dockerfile
FROM python:3.9
# define the args
ARG ARTIFACTORY_USER
ARG ARTIFACTORY_TOKEN
# configure poetry to use them
RUN poetry config http-basic.artifactory $ARTIFACTORY_USER $ARTIFACTORY_TOKEN
# then install
RUN poetry install
2. the "pre-built" workaround (ghcr bridge)
if you really just want to deploy a pre-built image and stop railway from building code, the best path is to use GHCR (GitHub Container Registry) as a middleman since railway integrates with it natively.
basically:
your ci (github actions) builds the image and pulls the whl file (since your ci already has access).
ci pushes the final image to
ghcr.io/your-org/image-name.on railway, you create a new service from "GitHub Container Registry" and pick that image.
this way railway never builds anything, it just pulls the finished container. avoids the whole poetry auth headache entirely.
let me know if you want a sample github workflow for the ghcr push method @chrbutt-droid
