File tree Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change 1
- # See https://fly.io/docs/app-guides/continuous-deployment-with-github-actions/
2
-
3
1
name : Fly Deploy
4
2
on :
5
3
push :
9
7
deploy :
10
8
name : Deploy app
11
9
runs-on : ubuntu-latest
12
- concurrency : deploy-group # optional: ensure only one action runs at a time
10
+ concurrency : deploy-group
13
11
steps :
14
12
- uses : actions/checkout@v4
13
+
15
14
- 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 }}
17
18
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 }}
Original file line number Diff line number Diff line change @@ -12,10 +12,15 @@ WORKDIR /app
12
12
# Set production environment
13
13
ENV NODE_ENV="production"
14
14
15
+ # Argument for NPM token
16
+ ARG NPM_TOKEN
15
17
16
18
# Throw-away build stage to reduce size of final image
17
19
FROM base as build
18
20
21
+ # Set the NPM_TOKEN as an environment variable
22
+ ENV NPM_TOKEN=${NPM_TOKEN}
23
+
19
24
# Install packages needed to build node modules
20
25
RUN apt-get update -qq && \
21
26
apt-get install --no-install-recommends -y build-essential pkg-config python-is-python3
@@ -34,6 +39,8 @@ RUN bun run build
34
39
RUN rm -rf node_modules && \
35
40
bun install --ci
36
41
42
+ # Remove .npmrc to avoid token leakage
43
+ RUN rm -f .npmrc
37
44
38
45
# Final stage for app image
39
46
FROM base
@@ -43,4 +50,4 @@ COPY --from=build /app /app
43
50
44
51
# Start the server by default, this can be overwritten at runtime
45
52
EXPOSE 3000
46
- CMD [ "bun" , "run" , "start" ]
53
+ CMD [ "bun" , "run" , "start" ]
You can’t perform that action at this time.
0 commit comments