mirror of
https://github.com/by-jp/www.byjp.me.git
synced 2025-08-11 03:25:33 +01:00
Docker container for serving Indiekit
This commit is contained in:
parent
2c41e09eeb
commit
4b955c72e8
6 changed files with 90 additions and 16 deletions
51
.github/workflows/indiekit-docker.yml
vendored
Normal file
51
.github/workflows/indiekit-docker.yml
vendored
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
name: Build Indiekit Docker container
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: ["main"]
|
||||||
|
paths:
|
||||||
|
- indiekit/**
|
||||||
|
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
attestations: write
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: "docker"
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
image-releaser:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Authenticate with Github Container Repository
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.repository_owner }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- name: Extract metadata (tags, labels) for Docker
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: by-jp/indiekit.byjp.me
|
||||||
|
- name: Build and push Docker image
|
||||||
|
id: push
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: ./indiekit
|
||||||
|
file: ./Dockerfile
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
14
indiekit/.dockerignore
Normal file
14
indiekit/.dockerignore
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
# Docker
|
||||||
|
.docker
|
||||||
|
.dockerignore
|
||||||
|
|
||||||
|
# Environment
|
||||||
|
.env
|
||||||
|
|
||||||
|
# Git
|
||||||
|
.git
|
||||||
|
.gitignore
|
||||||
|
|
||||||
|
# Node - as they may not be the same architecture
|
||||||
|
node_modules
|
||||||
|
npm-debug.log
|
19
indiekit/Dockerfile
Normal file
19
indiekit/Dockerfile
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
FROM node:20-alpine
|
||||||
|
|
||||||
|
WORKDIR /usr/src/app
|
||||||
|
ENV NODE_ENV=production
|
||||||
|
|
||||||
|
COPY package*.json ./
|
||||||
|
# Can’t use `npm ci` due to https://github.com/npm/cli/issues/4828
|
||||||
|
RUN npm i --omit=dev --no-fund
|
||||||
|
|
||||||
|
# Copy Indiekit config over
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
ENV SECRET=
|
||||||
|
ENV PASSWORD_SECRET=
|
||||||
|
ENV MONGO_URL=
|
||||||
|
ENV SITE=https://www.byjp.me/
|
||||||
|
ENV PORT=80
|
||||||
|
EXPOSE 80
|
||||||
|
CMD [ "npm", "run", "start" ]
|
|
@ -1,12 +0,0 @@
|
||||||
const env = require('dotenv').config().parsed || {};
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
apps : [
|
|
||||||
{
|
|
||||||
name: "indiekit",
|
|
||||||
script: "npm run start",
|
|
||||||
watch: false,
|
|
||||||
env,
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
|
|
@ -1,5 +1,8 @@
|
||||||
import dotenv from 'dotenv';
|
const env = (await (
|
||||||
const env = dotenv.config().parsed || {};
|
import('dotenv')
|
||||||
|
.then(dotenv => dotenv.config().parsed)
|
||||||
|
.catch(() => process.env)
|
||||||
|
)) || {};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
application: {
|
application: {
|
||||||
|
|
|
@ -5,8 +5,7 @@
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "indiekit serve",
|
"start": "indiekit serve"
|
||||||
"dotenv": "dotenv-run-script .env --"
|
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"indiekit",
|
"indiekit",
|
||||||
|
|
Loading…
Reference in a new issue