3 Commits

Author SHA1 Message Date
e666588cc3 Production build at container run time
All checks were successful
Build Production Image / Build Production Image (push) Successful in 58s
2024-01-14 12:39:49 -08:00
d98da909ae Testing actions
All checks were successful
Build Production Image / Build Production Image (push) Successful in 1m18s
2024-01-11 14:59:13 -08:00
c7d3f92558 Dockerize for running in production 2024-01-08 18:42:56 -08:00
6 changed files with 83 additions and 10 deletions

8
.dockerignore Normal file
View File

@ -0,0 +1,8 @@
# Don't copy node_modules
node_modules
# Ignore common folders that we do not need
.git
.next
.github
.vscode

View 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 }}

20
Dockerfile Normal file
View File

@ -0,0 +1,20 @@
FROM docker.io/library/node:18-alpine AS build-env
ENV NODE_ENV production
ENV PORT 3000
ENV NEXT_TELEMETRY_DISABLED 1
WORKDIR /app
# Building app
COPY package*.json ./
# Install node modules
# Note: We also install dev deps as TypeScript may be needed
RUN npm install
# Copy files. Use dockerignore to avoid copying node_modules
COPY . .
# Run app command
CMD ["/bin/ash", "/app/entrypoint.sh"]

7
entrypoint.sh Executable file
View 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

14
package-lock.json generated
View File

@ -42,7 +42,7 @@
"eslint-config-next": "13.4.16",
"prettier": "^3.0.1",
"prettier-plugin-tailwindcss": "^0.5.2",
"sharp": "^0.32.0"
"sharp": "0.32.6"
}
},
"node_modules/@aashutoshrathi/word-wrap": {
@ -8714,9 +8714,9 @@
"integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw=="
},
"node_modules/sharp": {
"version": "0.32.4",
"resolved": "https://registry.npmjs.org/sharp/-/sharp-0.32.4.tgz",
"integrity": "sha512-exUnZewqVZC6UXqXuQ8fyJJv0M968feBi04jb9GcUHrWtkRoAKnbJt8IfwT4NJs7FskArbJ14JAFGVuooszoGg==",
"version": "0.32.6",
"resolved": "https://registry.npmjs.org/sharp/-/sharp-0.32.6.tgz",
"integrity": "sha512-KyLTWwgcR9Oe4d9HwCwNM2l7+J0dUQwn/yf7S0EnTtb0eVS4RxO0eUSvxPtzT4F3SY+C4K6fqdv/DO27sJ/v/w==",
"dev": true,
"hasInstallScript": true,
"dependencies": {
@ -16578,9 +16578,9 @@
"integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw=="
},
"sharp": {
"version": "0.32.4",
"resolved": "https://registry.npmjs.org/sharp/-/sharp-0.32.4.tgz",
"integrity": "sha512-exUnZewqVZC6UXqXuQ8fyJJv0M968feBi04jb9GcUHrWtkRoAKnbJt8IfwT4NJs7FskArbJ14JAFGVuooszoGg==",
"version": "0.32.6",
"resolved": "https://registry.npmjs.org/sharp/-/sharp-0.32.6.tgz",
"integrity": "sha512-KyLTWwgcR9Oe4d9HwCwNM2l7+J0dUQwn/yf7S0EnTtb0eVS4RxO0eUSvxPtzT4F3SY+C4K6fqdv/DO27sJ/v/w==",
"dev": true,
"requires": {
"color": "^4.2.3",

View File

@ -35,6 +35,7 @@
"react": "18.2.0",
"react-dom": "18.2.0",
"remark-gfm": "^3.0.1",
"sharp": "0.32.6",
"stripe": "14.9.0",
"tailwindcss": "^3.3.3",
"typescript": "5.1.6"
@ -43,7 +44,6 @@
"eslint": "8.45.0",
"eslint-config-next": "13.4.16",
"prettier": "^3.0.1",
"prettier-plugin-tailwindcss": "^0.5.2",
"sharp": "^0.32.0"
"prettier-plugin-tailwindcss": "^0.5.2"
}
}
}