-
Notifications
You must be signed in to change notification settings - Fork 121
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
Showing
16 changed files
with
416 additions
and
12 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,10 @@ | ||
Dockerfile | ||
.dockerignore | ||
node_modules | ||
npm-debug.log | ||
README.md | ||
.next | ||
.git | ||
.idea | ||
.github | ||
.gitignore |
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,36 @@ | ||
name: Dev Docker Multi-arch Image CI & CD | ||
|
||
on: | ||
push: | ||
branches: | ||
- dev | ||
|
||
jobs: | ||
build: | ||
name: Running Compile Next Multi-arch Docker Image | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout PicImpact | ||
uses: actions/checkout@v4 | ||
- name: Get Version | ||
id: get_version | ||
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/} | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Set up Docker Buildx | ||
id: set_up_buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Build and push dev | ||
id: docker_build | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: ./ | ||
file: ./Dockerfile | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
tags: ${{ secrets.DOCKERHUB_USERNAME }}/picimpact:dev |
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,45 @@ | ||
name: Dev Docker Multi-arch Image CI & CD | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
jobs: | ||
build: | ||
name: Running Compile Next Multi-arch Docker Image | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout PicImpact | ||
uses: actions/checkout@v4 | ||
- name: Get Version | ||
id: get_version | ||
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/} | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Set up Docker Buildx | ||
id: set_up_buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Build and push latest | ||
id: docker_build | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: ./ | ||
file: ./Dockerfile | ||
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/ppc64le,linux/s390x | ||
push: true | ||
tags: ${{ secrets.DOCKERHUB_USERNAME }}/picimpact:latest | ||
- name: Build and push version | ||
id: docker_build | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: ./ | ||
file: ./Dockerfile | ||
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/ppc64le,linux/s390x | ||
push: true | ||
tags: ${{ secrets.DOCKERHUB_USERNAME }}/picimpact:${{ steps.get_version.outputs.VERSION }} |
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,53 @@ | ||
FROM node:18-alpine AS base | ||
|
||
# Install dependencies only when needed | ||
FROM base AS deps | ||
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed. | ||
RUN apk add --no-cache libc6-compat | ||
|
||
WORKDIR /app | ||
|
||
COPY package.json pnpm-lock.yaml* .npmrc ./ | ||
|
||
RUN corepack enable pnpm && pnpm i --frozen-lockfile | ||
|
||
FROM base AS builder | ||
|
||
WORKDIR /app | ||
|
||
COPY --from=deps /app/node_modules ./node_modules | ||
COPY . . | ||
|
||
RUN AUTH_SECRET=pic-impact export NODE_OPTIONS=--openssl-legacy-provider && corepack enable pnpm && pnpm run prisma:generate && pnpm run build | ||
|
||
FROM base AS runner | ||
|
||
WORKDIR /app | ||
|
||
ENV NODE_ENV production | ||
|
||
RUN addgroup --system --gid 1001 nodejs | ||
RUN adduser --system --uid 1001 nextjs | ||
|
||
COPY --from=builder /app/public ./public | ||
COPY ./prisma ./prisma | ||
COPY ./script.sh ./script.sh | ||
|
||
RUN chmod +x script.sh | ||
RUN mkdir .next | ||
RUN chown nextjs:nodejs .next | ||
|
||
# Automatically leverage output traces to reduce image size | ||
# https://nextjs.org/docs/advanced-features/output-file-tracing | ||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ | ||
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static | ||
|
||
USER nextjs | ||
|
||
ENV AUTH_TRUST_HOST true | ||
|
||
EXPOSE 3000 | ||
|
||
ENV PORT 3000 | ||
|
||
CMD ./script.sh |
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
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
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
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
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
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
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
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
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
Oops, something went wrong.