Skip to content

Commit 21e3798

Browse files
committed
tokens
1 parent a89519d commit 21e3798

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

.github/workflows/fly-deploy.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# See https://fly.io/docs/app-guides/continuous-deployment-with-github-actions/
2-
31
name: Fly Deploy
42
on:
53
push:
@@ -9,11 +7,13 @@ jobs:
97
deploy:
108
name: Deploy app
119
runs-on: ubuntu-latest
12-
concurrency: deploy-group # optional: ensure only one action runs at a time
10+
concurrency: deploy-group
1311
steps:
1412
- uses: actions/checkout@v4
13+
1514
- uses: superfly/flyctl-actions/setup-flyctl@master
16-
- run: flyctl deploy --local-only
15+
16+
- name: Deploy to Fly.io
17+
run: flyctl deploy --local-only --build-arg NPM_TOKEN=${{ secrets.GH_NPM_TOKEN }}
1718
env:
18-
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
19-
GH_NPM_TOKEN: ${{ secrets.GH_NPM_TOKEN }}
19+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

Dockerfile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,15 @@ WORKDIR /app
1212
# Set production environment
1313
ENV NODE_ENV="production"
1414

15+
# Argument for NPM token
16+
ARG NPM_TOKEN
1517

1618
# Throw-away build stage to reduce size of final image
1719
FROM base as build
1820

21+
# Set the NPM_TOKEN as an environment variable
22+
ENV NPM_TOKEN=${NPM_TOKEN}
23+
1924
# Install packages needed to build node modules
2025
RUN apt-get update -qq && \
2126
apt-get install --no-install-recommends -y build-essential pkg-config python-is-python3
@@ -34,6 +39,8 @@ RUN bun run build
3439
RUN rm -rf node_modules && \
3540
bun install --ci
3641

42+
# Remove .npmrc to avoid token leakage
43+
RUN rm -f .npmrc
3744

3845
# Final stage for app image
3946
FROM base
@@ -43,4 +50,4 @@ COPY --from=build /app /app
4350

4451
# Start the server by default, this can be overwritten at runtime
4552
EXPOSE 3000
46-
CMD [ "bun", "run", "start" ]
53+
CMD [ "bun", "run", "start" ]

0 commit comments

Comments
 (0)