Skip to content

Commit fc46c9f

Browse files
committed
fix: another attempt to fix the secret file path
1 parent b64f433 commit fc46c9f

File tree

5 files changed

+43
-7
lines changed

5 files changed

+43
-7
lines changed

.github/workflows/docker.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,14 @@ jobs:
3434

3535
- name: Check for .npmrc
3636
run: |
37+
pwd
38+
echo "---"
39+
ls -la | grep -E "^\\.|npmrc" || echo "No .npmrc found"
40+
echo "---"
41+
pwd_val=$PWD
3742
if [ -f .npmrc ]; then
3843
echo "HAS_NPMRC=true" >> $GITHUB_ENV
44+
echo "Full path: ${pwd_val}/.npmrc"
3945
echo "Using .npmrc:" && ls -l .npmrc && echo "---" && sed 's/_authToken=.*/_authToken=***REDACTED***/' .npmrc
4046
else
4147
echo "HAS_NPMRC=false" >> $GITHUB_ENV
@@ -63,7 +69,7 @@ jobs:
6369

6470
- name: 'BFF: Build and push ${{ env.PACKAGE_NAME }} (with .npmrc)'
6571
if: ${{ env.HAS_NPMRC == 'true' }}
66-
uses: docker/build-push-action@v4
72+
uses: docker/build-push-action@v6
6773
with:
6874
context: .
6975
file: ${{ matrix.package }}/Dockerfile
@@ -72,12 +78,14 @@ jobs:
7278
labels: ${{ steps.image_meta.outputs.labels }}
7379
builder: ${{ steps.setup-buildx.outputs.name }}
7480
platforms: linux/amd64
81+
cache-from: type=gha
82+
cache-to: type=gha,mode=max
7583
secret-files: |
76-
id=npmrc,src=${{ github.workspace }}/.npmrc
84+
id=npmrc,src=.npmrc
7785
7886
- name: 'BFF: Build and push ${{ env.PACKAGE_NAME }} (no .npmrc)'
7987
if: ${{ env.HAS_NPMRC != 'true' }}
80-
uses: docker/build-push-action@v4
88+
uses: docker/build-push-action@v6
8189
with:
8290
context: .
8391
file: ${{ matrix.package }}/Dockerfile

apps/api/Dockerfile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ RUN chown -R api:api .
2222
# You can remove this install step if you build with `--bundle` option.
2323
# The bundled output will include external dependencies.
2424
RUN --mount=type=secret,id=npmrc,target=/root/.npmrc,required=false \
25-
sh -eu -c 'ls -l /root/.npmrc || echo "/root/.npmrc not present"; yarn --cwd api --omit=dev -f install'
25+
sh -eu -c '
26+
if [ -f /root/.npmrc ]; then
27+
echo "Using .npmrc:" && cat /root/.npmrc | sed "s/_authToken=.*/_authToken=***REDACTED***/"
28+
else
29+
echo ".npmrc not present - building without GitHub Packages auth"
30+
fi
31+
yarn --cwd api --omit=dev -f install
32+
'
2633

2734
CMD [ "node", "api" ]

apps/notification-producer/Dockerfile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ RUN chown -R notification-producer:notification-producer .
2121
# You can remove this install step if you build with `--bundle` option.
2222
# The bundled output will include external dependencies.
2323
RUN --mount=type=secret,id=npmrc,target=/root/.npmrc,required=false \
24-
sh -eu -c 'ls -l /root/.npmrc || echo "/root/.npmrc not present"; yarn --cwd notification-producer install --production --force'
24+
sh -eu -c '
25+
if [ -f /root/.npmrc ]; then
26+
echo "Using .npmrc:" && cat /root/.npmrc | sed "s/_authToken=.*/_authToken=***REDACTED***/"
27+
else
28+
echo ".npmrc not present - building without GitHub Packages auth"
29+
fi
30+
yarn --cwd notification-producer install --production --force
31+
'
2532

2633
CMD [ "node", "notification-producer" ]

apps/telegram/Dockerfile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ RUN chown -R telegram:telegram .
2121
# You can remove this install step if you build with `--bundle` option.
2222
# The bundled output will include external dependencies.
2323
RUN --mount=type=secret,id=npmrc,target=/root/.npmrc,required=false \
24-
sh -eu -c 'ls -l /root/.npmrc || echo "/root/.npmrc not present"; yarn --cwd telegram install --production --force'
24+
sh -eu -c '
25+
if [ -f /root/.npmrc ]; then
26+
echo "Using .npmrc:" && cat /root/.npmrc | sed "s/_authToken=.*/_authToken=***REDACTED***/"
27+
else
28+
echo ".npmrc not present - building without GitHub Packages auth"
29+
fi
30+
yarn --cwd telegram install --production --force
31+
'
2532

2633
CMD [ "node", "telegram" ]

apps/twap/Dockerfile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ RUN chown -R twap:twap .
2121
# You can remove this install step if you build with `--bundle` option.
2222
# The bundled output will include external dependencies.
2323
RUN --mount=type=secret,id=npmrc,target=/root/.npmrc,required=false \
24-
sh -eu -c 'ls -l /root/.npmrc || echo "/root/.npmrc not present"; yarn --cwd twap --omit=dev -f install'
24+
sh -eu -c '
25+
if [ -f /root/.npmrc ]; then
26+
echo "Using .npmrc:" && cat /root/.npmrc | sed "s/_authToken=.*/_authToken=***REDACTED***/"
27+
else
28+
echo ".npmrc not present - building without GitHub Packages auth"
29+
fi
30+
yarn --cwd twap --omit=dev -f install
31+
'
2532

2633
CMD [ "node", "twap" ]

0 commit comments

Comments
 (0)