Skip to content

Commit

Permalink
yarn woes #1
Browse files Browse the repository at this point in the history
  • Loading branch information
trinitytakei committed Feb 21, 2025
1 parent 8fe7565 commit e19b2f7
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# syntax = docker/dockerfile:1
-# syntax = docker/dockerfile:1
# check=error=true

ARG RUBY_VERSION=3.4.1
Expand Down Expand Up @@ -95,6 +95,15 @@ COPY --from=nodejs /usr/local/share/ /usr/local/share/
COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}"
COPY --from=build /rails /rails

# Clean up any existing Yarn and set up 4.6.0
RUN apt-get remove -y yarn || true && \
rm -f /usr/local/bin/yarn /usr/local/bin/yarnpkg && \
corepack enable && \
corepack prepare yarn@4.6.0 --activate && \
# Make sure corepack directories are owned by rails user (will be created next)
mkdir -p /usr/local/share/.corepack /usr/local/share/nvm && \
chown -R 1000:1000 /usr/local/share/.corepack /usr/local/share/nvm || true

# Create the rails user first
RUN groupadd --system --gid 1000 rails && \
useradd rails --uid 1000 --gid 1000 --create-home --shell /bin/bash && \
Expand All @@ -108,14 +117,6 @@ RUN groupadd --system --gid 1000 rails && \
chmod -R 755 /rails && \
chown -R rails:rails db log storage tmp /usr/local/bundle

# Clean up any existing Yarn and set up 4.6.0
RUN apt-get remove -y yarn || true && \
rm -f /usr/local/bin/yarn /usr/local/bin/yarnpkg && \
corepack enable && \
corepack prepare yarn@4.6.0 --activate && \
# Make sure corepack directories are owned by rails user (will be created next)
chown -R rails:rails /usr/local/share/.corepack /usr/local/share/nvm

USER rails

# Entrypoint prepares the database.
Expand Down

0 comments on commit e19b2f7

Please sign in to comment.