Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "git-to.dev",
"build": {
"dockerfile": "../Dockerfile",
"context": "..",
"target": "development"
},
"workspaceFolder": "/workspace/${localWorkspaceFolderBasename}",
"remoteUser": "node",
"forwardPorts": [3000],
"portsAttributes": {
"3000": {
"label": "Next.js development server",
"onAutoForward": "notify"
}
},
"postCreateCommand": "pnpm install --frozen-lockfile",
"customizations": {
"vscode": {
"extensions": [
"dbaeumer.vscode-eslint",
"bradlc.vscode-tailwindcss"
]
}
}
}
10 changes: 10 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.git
.github
.next
.devcontainer
node_modules
.env*
!.env.example
npm-debug.log*
pnpm-debug.log*
README.md
22 changes: 22 additions & 0 deletions .github/workflows/devcontainer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Dev Container

on:
pull_request:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Build dev container
uses: devcontainers/ci@v0.3
with:
configFile: .devcontainer/devcontainer.json
push: never
26 changes: 26 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Docker

on:
pull_request:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: false
45 changes: 45 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# syntax=docker/dockerfile:1

ARG NODE_VERSION=22
ARG PNPM_VERSION=10.14.0

FROM node:${NODE_VERSION}-bookworm-slim AS base
ARG PNPM_VERSION
ENV NEXT_TELEMETRY_DISABLED=1 \
PNPM_HOME=/pnpm \
PATH=/pnpm:${PATH}
RUN npm install --global "pnpm@${PNPM_VERSION}"
WORKDIR /app

FROM base AS dependencies
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile

FROM dependencies AS development
ENV NODE_ENV=development
RUN chown -R node:node /app
USER node
EXPOSE 3000
CMD ["pnpm", "dev", "--hostname", "0.0.0.0"]

FROM dependencies AS builder
COPY . .
RUN pnpm build

FROM node:${NODE_VERSION}-bookworm-slim AS runner
ENV NODE_ENV=production \
NEXT_TELEMETRY_DISABLED=1 \
HOSTNAME=0.0.0.0 \
PORT=3000
WORKDIR /app

RUN addgroup --system --gid 1001 nodejs \
&& adduser --system --uid 1001 nextjs

COPY --from=builder --chown=nextjs:nodejs /app/public ./public
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static

USER nextjs
EXPOSE 3000
CMD ["node", "server.js"]
29 changes: 28 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,34 @@ Open [http://localhost:3000](http://localhost:3000). Set `GITHUB_TOKEN` (or
`GH_TOKEN`) to increase GitHub API rate limits; unauthenticated requests are
supported.

## Checks
## Docker

Build and run the production image:

```bash
docker build -t git-to-dev .
docker run --rm -p 3000:3000 git-to-dev
```

The image uses Next.js standalone output and runs as an unprivileged user. To use
authenticated GitHub API requests, pass a token when starting the container:

```bash
docker run --rm -p 3000:3000 -e GITHUB_TOKEN git-to-dev
```

## Development container

Open the repository in a [Development Containers](https://containers.dev/)
compatible editor and choose **Reopen in Container**. The development container
builds the `development` target from the same `Dockerfile`, installs the locked
dependencies, and forwards port 3000. Start the app from its terminal with:

```bash
pnpm dev
```

## Learn More

```bash
pnpm lint
Expand Down
1 change: 1 addition & 0 deletions next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
output: "standalone",
typescript: {
ignoreBuildErrors: true,
},
Expand Down
Loading