0x5CD59377
0x5CD59377
RRailway
Created by 0x5CD59377 on 2/8/2024 in #✋|help
Docker application not finding env var set in service's Variables tab
it worked! thanks so much :)
13 replies
RRailway
Created by 0x5CD59377 on 2/8/2024 in #✋|help
Docker application not finding env var set in service's Variables tab
i'll give this a shot
13 replies
RRailway
Created by 0x5CD59377 on 2/8/2024 in #✋|help
Docker application not finding env var set in service's Variables tab
here's my dockerfile
13 replies
RRailway
Created by 0x5CD59377 on 2/8/2024 in #✋|help
Docker application not finding env var set in service's Variables tab
# syntax=docker/dockerfile:1

# Comments are provided throughout this file to help you get started.
# If you need more help, visit the Dockerfile reference guide at
# https://docs.docker.com/go/dockerfile-reference/

# Want to help us make this template better? Share your feedback here: https://forms.gle/ybq9Krt8jtBL3iCk7

ARG PYTHON_VERSION=3.11.7
ARG NODE_VERSION=18.17.1
FROM node:${NODE_VERSION}-alpine as build
WORKDIR /app
# RUN --mount=type=bind,source=package.json,target=package.json \
# --mount=type=bind,source=yarn.lock,target=yarn.lock \
# yarn install
COPY package.json yarn.lock ./
RUN yarn install
COPY . .
RUN yarn build

FROM python:${PYTHON_VERSION}-slim as base

# Prevents Python from writing pyc files.
ENV PYTHONDONTWRITEBYTECODE=1

# Keeps Python from buffering stdout and stderr to avoid situations where
# the application crashes without emitting any logs due to buffering.
ENV PYTHONUNBUFFERED=1

# Railway.app specifies the port we should listen on
# We default to 8000 in a local environment
ENV PORT=8000

WORKDIR /app

# Create a non-privileged user that the app will run under.
# See https://docs.docker.com/go/dockerfile-user-best-practices/
ARG UID=10001
RUN adduser \
--disabled-password \
--gecos "" \
--home "/nonexistent" \
--shell "/sbin/nologin" \
--no-create-home \
--uid "${UID}" \
appuser

# Download dependencies as a separate step to take advantage of Docker's caching.
# Leverage a cache mount to /root/.cache/pip to speed up subsequent builds.
# Leverage a bind mount to requirements.txt to avoid having to copy them into
# into this layer.
RUN apt update && apt install -y --no-install-recommends libmagic-dev build-essential && rm -rf /var/lib/apt/lists/*
RUN pip install poetry

# RUN --mount=type=cache,id=s/2e9c673d-c965-440e-81a8-f03b0ad4a826-/pip-cache,target=/root/.cache/pip \
# --mount=type=bind,source=pyproject.toml,target=pyproject.toml \
# --mount=type=bind,source=poetry.lock,target=poetry.lock \
# poetry export -f requirements.txt --output requirements.txt && python -m pip install -r requirements.txt
COPY pyproject.toml poetry.lock ./
RUN poetry export -f requirements.txt --output requirements.txt && python -m pip install -r requirements.txt

# Switch to the non-privileged user to run the application.
USER appuser

# Copy the source code into the container.
COPY --from=build /app/build /app/build
COPY ./app /app/app
COPY ./public /app/public
# COPY .env /app/.env

# Expose the port that the application listens on.
EXPOSE $PORT

# Run the application.
CMD gunicorn app:app
# syntax=docker/dockerfile:1

# Comments are provided throughout this file to help you get started.
# If you need more help, visit the Dockerfile reference guide at
# https://docs.docker.com/go/dockerfile-reference/

# Want to help us make this template better? Share your feedback here: https://forms.gle/ybq9Krt8jtBL3iCk7

ARG PYTHON_VERSION=3.11.7
ARG NODE_VERSION=18.17.1
FROM node:${NODE_VERSION}-alpine as build
WORKDIR /app
# RUN --mount=type=bind,source=package.json,target=package.json \
# --mount=type=bind,source=yarn.lock,target=yarn.lock \
# yarn install
COPY package.json yarn.lock ./
RUN yarn install
COPY . .
RUN yarn build

FROM python:${PYTHON_VERSION}-slim as base

# Prevents Python from writing pyc files.
ENV PYTHONDONTWRITEBYTECODE=1

# Keeps Python from buffering stdout and stderr to avoid situations where
# the application crashes without emitting any logs due to buffering.
ENV PYTHONUNBUFFERED=1

# Railway.app specifies the port we should listen on
# We default to 8000 in a local environment
ENV PORT=8000

WORKDIR /app

# Create a non-privileged user that the app will run under.
# See https://docs.docker.com/go/dockerfile-user-best-practices/
ARG UID=10001
RUN adduser \
--disabled-password \
--gecos "" \
--home "/nonexistent" \
--shell "/sbin/nologin" \
--no-create-home \
--uid "${UID}" \
appuser

# Download dependencies as a separate step to take advantage of Docker's caching.
# Leverage a cache mount to /root/.cache/pip to speed up subsequent builds.
# Leverage a bind mount to requirements.txt to avoid having to copy them into
# into this layer.
RUN apt update && apt install -y --no-install-recommends libmagic-dev build-essential && rm -rf /var/lib/apt/lists/*
RUN pip install poetry

# RUN --mount=type=cache,id=s/2e9c673d-c965-440e-81a8-f03b0ad4a826-/pip-cache,target=/root/.cache/pip \
# --mount=type=bind,source=pyproject.toml,target=pyproject.toml \
# --mount=type=bind,source=poetry.lock,target=poetry.lock \
# poetry export -f requirements.txt --output requirements.txt && python -m pip install -r requirements.txt
COPY pyproject.toml poetry.lock ./
RUN poetry export -f requirements.txt --output requirements.txt && python -m pip install -r requirements.txt

# Switch to the non-privileged user to run the application.
USER appuser

# Copy the source code into the container.
COPY --from=build /app/build /app/build
COPY ./app /app/app
COPY ./public /app/public
# COPY .env /app/.env

# Expose the port that the application listens on.
EXPOSE $PORT

# Run the application.
CMD gunicorn app:app
13 replies
RRailway
Created by 0x5CD59377 on 2/8/2024 in #✋|help
Docker application not finding env var set in service's Variables tab
oh sorry. vite is being built to yarn build and then served with gunicorn
13 replies
RRailway
Created by 0x5CD59377 on 2/8/2024 in #✋|help
Docker application not finding env var set in service's Variables tab
also, my application works fine if i build and run the dockerfile locally
13 replies
RRailway
Created by 0x5CD59377 on 2/7/2024 in #✋|help
yarn install encountering network issues
no longer seeing this issue, thanks!
6 replies
RRailway
Created by 0x5CD59377 on 2/7/2024 in #✋|help
yarn install encountering network issues
i'm redeploying rn, will update
6 replies