generated from stegripe/template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
mzrtamp
committed
Mar 7, 2024
1 parent
0732915
commit 15cfad7
Showing
2 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Build & Push Docker Image to container image registry | ||
|
||
on: | ||
release: | ||
types: [created] | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- "Dockerfile" | ||
|
||
jobs: | ||
docker: | ||
uses: stegripe/workflows/.github/workflows/docker-build.yml@main | ||
secrets: inherit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
FROM ghcr.io/hazmi35/node:21-dev-alpine as build-stage | ||
|
||
# Prepare pnpm with corepack (experimental feature) | ||
RUN corepack enable && corepack prepare pnpm@latest | ||
|
||
# Copy package.json, lockfile and npm config files | ||
COPY package.json pnpm-lock.yaml *.npmrc ./ | ||
|
||
# Fetch dependencies to virtual store | ||
RUN pnpm fetch | ||
|
||
# Install dependencies | ||
RUN pnpm install --offline --frozen-lockfile | ||
|
||
# Copy Project files | ||
COPY . . | ||
|
||
# Build TypeScript Project | ||
RUN pnpm run build | ||
|
||
# Prune devDependencies | ||
RUN pnpm prune --production | ||
|
||
# Get ready for production | ||
FROM ghcr.io/hazmi35/node:21-alpine | ||
|
||
LABEL name "linkbio" | ||
LABEL maintainer "Stegripe <[email protected]>" | ||
|
||
# Copy needed files | ||
COPY --from=build-stage /tmp/build/package.json . | ||
COPY --from=build-stage /tmp/build/.next/ ./.next | ||
COPY --from=build-stage /tmp/build/node_modules ./node_modules | ||
COPY --from=build-stage /tmp/build/next.config.js ./ | ||
|
||
# Additional Environment Variables | ||
ENV NODE_ENV production | ||
|
||
# Expose the port the app runs on | ||
EXPOSE 3000 | ||
|
||
# Start the app with node | ||
CMD ["npm", "run", "start"] |