Skip to content

Commit

Permalink
Adjust Docker image
Browse files Browse the repository at this point in the history
- Move to .docker
- Build image when relevant files were changed
  • Loading branch information
stefandesu committed Jul 18, 2024
1 parent 9fb4763 commit 97c4c75
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 8 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion docker/Dockerfile → .docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ RUN node -v
RUN npm -v

## Make Docker-related scripts available in root folder
COPY docker/*.sh .
COPY .docker/*.sh .

## Use http-server for serving the site
RUN npm i -g http-server
Expand Down
3 changes: 1 addition & 2 deletions docker/README.md → .docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
Create a `docker-compose.yml` file:

```yml
version: "3"
services:
jskos-web:
image: ghcr.io/gbv/jskos-web
Expand Down Expand Up @@ -43,4 +42,4 @@ The app will be served on port 80.

## Publishing the Docker Image

For maintainers: As the site within the container uses Git to keep itself updated, updates to the published image won't be necessary unless there are changes to the image itself (`Dockerfile` or any of the Docker-related scripts). To trigger an updated Docker image, go to https://github.com/gbv/jskos-web/actions/workflows/docker.yml and run the workflow on branch `main`.
For maintainers: As the site within the container uses Git to keep itself updated, updates to the published image won't be necessary unless there are changes to the image itself (`Dockerfile` or any of the Docker-related scripts). The Docker workflow on GitHub will therefore only build and publish a new image when necessary.
File renamed without changes.
2 changes: 1 addition & 1 deletion docker/docker-compose.yml → .docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ services:
# image: ghcr.io/gbv/jskos-web
build:
context: ..
dockerfile: docker/Dockerfile
dockerfile: .docker/Dockerfile
volumes:
- ./data:/usr/src/app/dist
ports:
Expand Down
File renamed without changes.
14 changes: 11 additions & 3 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
name: Publish Docker
# Needs to be manually triggered (as an update is only required if the Dockerfile or related scripts were updated)
on: workflow_dispatch
# Only run when Docker-related files are changed
on:
push:
branches:
- main
paths:
- .docker/Dockerfile
- .docker/entrypoint.sh
- .docker/build.sh
- .github/workflows/docker.yml

# Adapted from:
# - https://github.com/docker/metadata-action#semver
Expand Down Expand Up @@ -37,7 +45,7 @@ jobs:
uses: docker/build-push-action@v4
with:
context: .
file: docker/Dockerfile
file: .docker/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dist-ssr

.env

docker/data
.docker/data

# pm2 ecosystem file
ecosystem.config.json

0 comments on commit 97c4c75

Please sign in to comment.