-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from mborne/docker
Add Dockerfile to build an image
- Loading branch information
Showing
5 changed files
with
93 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/vendor/ | ||
/output/ | ||
/.git/ | ||
/satis.json | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
FROM composer:latest | ||
|
||
ARG UID=1000 | ||
ARG GID=1000 | ||
RUN addgroup --gid "$GID" satis \ | ||
&& adduser \ | ||
--disabled-password \ | ||
--gecos "" \ | ||
--home "/home/satis-gitlab" \ | ||
--ingroup "satis" \ | ||
--uid "$UID" \ | ||
satis | ||
|
||
RUN mkdir -p /opt/satis-gitlab | ||
WORKDIR /opt/satis-gitlab | ||
COPY composer.json . | ||
COPY composer.lock . | ||
RUN composer install | ||
|
||
WORKDIR /opt/satis-gitlab | ||
COPY src/ src | ||
COPY bin/ bin | ||
|
||
RUN mkdir -p /opt/satis-gitlab/config \ | ||
&& chown -R satis:satis /opt/satis-gitlab/config | ||
VOLUME /opt/satis-gitlab/config | ||
|
||
RUN mkdir -p /opt/satis-gitlab/public \ | ||
&& chown -R satis:satis /opt/satis-gitlab/public | ||
VOLUME /opt/satis-gitlab/public | ||
|
||
USER satis |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# satis-gitlab - Usage with docker | ||
|
||
## Motivation | ||
|
||
Provide a docker image for satis-gitlab to : | ||
|
||
* Create a static site with pages using GitLab-CI or GitHub actions | ||
* Ease the built of a custom image with a custom update loop | ||
|
||
## Build image | ||
|
||
```bash | ||
docker build -t satis-gitlab . | ||
``` | ||
|
||
## Create static site content | ||
|
||
```bash | ||
# create satis-gitlab container | ||
docker run \ | ||
-v satis-data:/opt/satis-gitlab/public \ | ||
-v satis-config:/opt/satis-gitlab/config \ | ||
--env-file=../satis-gitlab.env \ | ||
--rm -ti satis-gitlab /bin/bash | ||
|
||
# generate config/satis.json | ||
bin/satis-gitlab gitlab-to-config \ | ||
--homepage https://satis.dev.localhost \ | ||
--output config/satis.json https://github.com \ | ||
--users=mborne $SATIS_GITHUB_TOKEN | ||
|
||
# generate public from config/satis.json with satis | ||
git config --global github.accesstoken $SATIS_GITHUB_TOKEN | ||
bin/satis-gitlab build config/satis.json public -v | ||
``` | ||
|
||
## Serve static site content | ||
|
||
```bash | ||
# see http://localhost:8888 | ||
docker run --rm -ti -v satis-data:/usr/share/nginx/html -p 8888:8080 nginxinc/nginx-unprivileged:1.26 | ||
``` | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,16 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<phpunit | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd" | ||
colors="true" | ||
verbose="true" | ||
failOnRisky="true" | ||
beStrictAboutChangesToGlobalState="true" | ||
beStrictAboutOutputDuringTests="true" | ||
beStrictAboutTestsThatDoNotTestAnything="true" | ||
bootstrap="./vendor/autoload.php" | ||
> | ||
|
||
<testsuites> | ||
<testsuite name="satis-gitlab"> | ||
<directory>./tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
|
||
<filter> | ||
<whitelist processUncoveredFilesFromWhitelist="true"> | ||
<directory suffix=".php">./src</directory> | ||
</whitelist> | ||
</filter> | ||
|
||
<php> | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" colors="true" verbose="true" failOnRisky="true" beStrictAboutChangesToGlobalState="true" beStrictAboutOutputDuringTests="true" beStrictAboutTestsThatDoNotTestAnything="true" bootstrap="./vendor/autoload.php"> | ||
<coverage processUncoveredFiles="true"> | ||
<include> | ||
<directory suffix=".php">./src</directory> | ||
</include> | ||
</coverage> | ||
<testsuites> | ||
<testsuite name="satis-gitlab"> | ||
<directory>./tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
<php> | ||
|
||
</php> | ||
|
||
</phpunit> |