Skip to content

Commit 15c2c21

Browse files
authored
Merge pull request #79 from MaxwellDPS/master
Adds Docker Support
2 parents 849c38f + 9ac5a36 commit 15c2c21

File tree

3 files changed

+99
-0
lines changed

3 files changed

+99
-0
lines changed

.github/workflows/docker.yaml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
6+
# GitHub recommends pinning actions to a commit SHA.
7+
# To get a newer version, you will need to update the SHA.
8+
# You can also reference a tag or branch, but the action may change without warning.
9+
10+
name: Publish Docker image
11+
12+
on:
13+
release:
14+
types: [published]
15+
push:
16+
branches: [ "main", "master" ]
17+
# tags: [ 'v*.*.*' ]
18+
19+
jobs:
20+
push_to_registry:
21+
name: Push Docker images to Docker Hub
22+
runs-on: ubuntu-latest
23+
permissions:
24+
packages: write
25+
contents: read
26+
# attestations: write
27+
steps:
28+
- name: Check out the repo
29+
uses: actions/checkout@v4
30+
31+
- name: Log in to Docker Hub
32+
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
33+
with:
34+
username: ${{ secrets.DOCKER_USERNAME }}
35+
password: ${{ secrets.DOCKER_PASSWORD }}
36+
37+
- name: Extract metadata (tags, labels) for ghost-static-site-generator Image
38+
id: ghost-static-site-generator
39+
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
40+
with:
41+
images: ${{ secrets.DOCKER_USERNAME }}/ghost-static-site-generator
42+
43+
- name: Build and push ghost-static-site-generator Docker image
44+
id: build-push-ghost-static-site-generator
45+
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
46+
with:
47+
context: .
48+
file: ./Dockerfile
49+
push: true
50+
tags: ${{ steps.ghost-static-site-generator.outputs.tags }}
51+
labels: ${{ steps.ghost-static-site-generator.outputs.labels }}

Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM node:alpine
2+
3+
# install wget
4+
RUN apk update && apk add --no-cache wget && \
5+
mkdir -p /app/node_modules
6+
7+
# copy code and install node deps
8+
WORKDIR /home/node/app
9+
COPY package*.json ./
10+
COPY --chown=node:node . .
11+
RUN npm install
12+
13+
# set workdir to /data
14+
WORKDIR /data
15+
16+
# describe volume
17+
VOLUME "/data"
18+
19+
# set entrypoint to script
20+
ENTRYPOINT [ "node", "/home/node/app/src/index.js" ]

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,34 @@ $ cd ghost-static-site-generator
4343
$ npm install
4444
```
4545

46+
### Docker
47+
To install docker see: [https://docs.docker.com/engine/install/](https://docs.docker.com/engine/install/)
48+
1. [Optional Build] Clone this repository
49+
```bash
50+
$ git clone https://github.com/itsignacioportal/ghost-static-site-generator/
51+
$ cd ghost-static-site-generator
52+
$ docker build -t ghost-static-site-generator:latest .
53+
```
54+
55+
2. Run image with volume mounted.
56+
#### Network config
57+
- to access localhost add `--network host`
58+
- to access another container
59+
1. `docker network create --attachable ghost-scrape`
60+
2. `docker network connect ghost-scrape <YOUR GHOST CONTAINER>`
61+
3. add `--network ghost-scrape` to your command
62+
63+
```bash
64+
# Make output dir
65+
$ mkdir ./data
66+
67+
# Run and remove container when done
68+
$ docker run --rm -it \
69+
-v ./data:/data \
70+
SimonM0/ghost-static-site-generator:latest \
71+
--domain http://www.myhiddenserver.com:4538 \
72+
--productionDomain http://www.myblog.com
73+
```
4674

4775
## Usages
4876
By default the tool will default to `http://localhost:2368` for the domain and generate a folder called `static` in the directory that you run the tool in.

0 commit comments

Comments
 (0)