Skip to content

Commit

Permalink
Merge pull request #41 from prose-im/master
Browse files Browse the repository at this point in the history
feat: dockerfile + auto-publish docker image
  • Loading branch information
valeriansaliou authored Aug 28, 2024
2 parents 7bf6f8b + 6268ddd commit c640605
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,46 @@ jobs:
path: ./build-${{ steps.current_revision.outputs.short }}.tar.gz
retention-days: 7

ship:
needs: build
runs-on: ubuntu-latest

permissions:
packages: write

env:
REGISTRY: ghcr.io

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
sparse-checkout: |
env/nginx/
Dockerfile
- name: Log in to the container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: ${{ needs.build.outputs.revision }} Build

- name: Extract build artifacts
run: tar -xzvf ./build-${{ needs.build.outputs.revision }}.tar.gz

- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ env.REGISTRY }}/${{ github.repository }}:${{ needs.build.outputs.revision }}

deploy:
needs: build
environment: docs.prose.org
Expand Down
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM nginx:1.27-alpine-slim as web

RUN rm -rf /etc/nginx/ /var/www/

COPY ./env/nginx /etc/nginx/
COPY ./build /var/www/

EXPOSE 8080/tcp
21 changes: 21 additions & 0 deletions env/nginx/mime.types
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
types {
text/html html;
text/css css;
text/xml xml;
text/plain txt;

application/javascript js;
application/json json;

image/jpeg jpeg jpg;
image/gif gif;
image/png png;
image/svg+xml svg;
image/webp webp;
image/x-icon ico;

audio/webm weba;

font/woff woff;
font/woff2 woff2;
}
17 changes: 17 additions & 0 deletions env/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
worker_processes 1;
error_log /dev/stdout info;

events {}

http {
include mime.types;
charset utf-8;
access_log /dev/stdout;

server {
listen 8080;
server_name localhost;

include site.conf;
}
}
9 changes: 9 additions & 0 deletions env/nginx/site.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root /var/www/;

error_page 404 /not_found/;

location ~ ^/((favicon\.ico)|(favicon(-\d+x\d+)?\.png)) {
rewrite ^/(.*) /static/user/favicons/$1 break;
}

expires 1h;

0 comments on commit c640605

Please sign in to comment.