Compare commits
2 Commits
7391a09ee2
...
0.0.13
Author | SHA1 | Date | |
---|---|---|---|
e666588cc3 | |||
d98da909ae |
@ -2,6 +2,7 @@
|
||||
node_modules
|
||||
|
||||
# Ignore common folders that we do not need
|
||||
.git
|
||||
.next
|
||||
.github
|
||||
.vscode
|
38
.gitea/workflows/image-build.yaml
Normal file
38
.gitea/workflows/image-build.yaml
Normal file
@ -0,0 +1,38 @@
|
||||
name: Build Production Image
|
||||
run-name: $GITHUB_REF_TYPE Production Build
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*.*.*'
|
||||
|
||||
jobs:
|
||||
Build Production Image:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: git.grosinger.net/tgrosinger/runner-image:0.0.3
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Login to Gitea Docker registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: git.grosinger.net
|
||||
username: tgrosinger
|
||||
password: ${{ secrets.CONTAINER_REGISTRY_ACCESS_TOKEN }}
|
||||
|
||||
- name: Create env file for Nextjs verification step
|
||||
run: |
|
||||
echo "POSTMARK_SERVER_TOKEN=dummy-token" > /workspace/tgrosinger/west-sound-hall/.env
|
||||
echo "NEXT_PUBLIC_SITE_URL=http://localhost:3000" >> /workspace/tgrosinger/west-sound-hall/.env
|
||||
cat /workspace/tgrosinger/west-sound-hall/.env
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: git.grosinger.net/tgrosinger/west-sound-hall:${{ gitea.ref_name }}
|
23
Dockerfile
23
Dockerfile
@ -1,6 +1,7 @@
|
||||
FROM docker.io/library/node:18-alpine AS build-env
|
||||
|
||||
# Disable telemetry
|
||||
ENV NODE_ENV production
|
||||
ENV PORT 3000
|
||||
ENV NEXT_TELEMETRY_DISABLED 1
|
||||
|
||||
WORKDIR /app
|
||||
@ -15,23 +16,5 @@ RUN npm install
|
||||
# Copy files. Use dockerignore to avoid copying node_modules
|
||||
COPY . .
|
||||
|
||||
# Build
|
||||
RUN npm run build
|
||||
|
||||
# Running the app
|
||||
FROM gcr.io/distroless/nodejs:18 AS runner
|
||||
WORKDIR /app
|
||||
|
||||
# Mark as prod, disable telemetry, set port
|
||||
ENV NODE_ENV production
|
||||
ENV PORT 3000
|
||||
ENV NEXT_TELEMETRY_DISABLED 1
|
||||
|
||||
# Copy from build
|
||||
COPY --from=build-env /app/next.config.mjs ./
|
||||
COPY --from=build-env /app/public ./public
|
||||
COPY --from=build-env /app/.next ./.next
|
||||
COPY --from=build-env /app/node_modules ./node_modules
|
||||
|
||||
# Run app command
|
||||
CMD ["./node_modules/next/dist/bin/next", "start"]
|
||||
CMD ["/bin/ash", "/app/entrypoint.sh"]
|
7
entrypoint.sh
Executable file
7
entrypoint.sh
Executable file
@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
# The build step hard-codes variables from the environment into HTML, so it must
|
||||
# be done with the correct .env.local for runtime.
|
||||
|
||||
./node_modules/next/dist/bin/next build
|
||||
./node_modules/next/dist/bin/next start
|
Reference in New Issue
Block a user