Merge branch 'dockerfile' into 'develop'
Add Dockerfile See merge request soapbox-pub/soapbox-fe!1468
This commit is contained in:
commit
275cef4453
5 changed files with 104 additions and 0 deletions
32
.dockerignore
Normal file
32
.dockerignore
Normal file
|
@ -0,0 +1,32 @@
|
|||
/node_modules/
|
||||
/tmp/
|
||||
/build/
|
||||
/coverage/
|
||||
/.coverage/
|
||||
/.eslintcache
|
||||
/.env
|
||||
/deploy.sh
|
||||
/.vs/
|
||||
yarn-error.log*
|
||||
/junit.xml
|
||||
|
||||
/static/
|
||||
/static-test/
|
||||
/public/
|
||||
/dist/
|
||||
|
||||
.idea
|
||||
.DS_Store
|
||||
|
||||
# Custom build files
|
||||
/custom/**/*
|
||||
!/custom/*
|
||||
/custom/*.*
|
||||
!/custom/.gitkeep
|
||||
!/custom/**/.gitkeep
|
||||
|
||||
# surge.sh
|
||||
/CNAME
|
||||
/AUTH
|
||||
/CORS
|
||||
/ROUTER
|
14
Dockerfile
Normal file
14
Dockerfile
Normal file
|
@ -0,0 +1,14 @@
|
|||
FROM node:18 as build
|
||||
WORKDIR /app
|
||||
COPY package.json .
|
||||
COPY yarn.lock .
|
||||
RUN yarn
|
||||
COPY . .
|
||||
ARG NODE_ENV=production
|
||||
RUN yarn build
|
||||
|
||||
FROM nginx:stable-alpine
|
||||
EXPOSE 5000
|
||||
ENV PORT=5000
|
||||
COPY installation/docker.conf.template /etc/nginx/templates/default.conf.template
|
||||
COPY --from=build /app/static /usr/share/nginx/html
|
7
app.json
Normal file
7
app.json
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"name": "Soapbox",
|
||||
"description": "Software for the next generation of social media.",
|
||||
"keywords": ["fediverse"],
|
||||
"website": "https://soapbox.pub",
|
||||
"stack": "container"
|
||||
}
|
3
heroku.yml
Normal file
3
heroku.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
build:
|
||||
docker:
|
||||
web: Dockerfile
|
48
installation/docker.conf.template
Normal file
48
installation/docker.conf.template
Normal file
|
@ -0,0 +1,48 @@
|
|||
# Soapbox Nginx for Docker.
|
||||
# It's intended to be used by the official nginx image, which has templating functionality.
|
||||
# Mount at: `/etc/nginx/templates/default.conf.template`
|
||||
|
||||
server {
|
||||
listen ${PORT};
|
||||
|
||||
keepalive_timeout 70;
|
||||
sendfile on;
|
||||
client_max_body_size 80m;
|
||||
|
||||
root /usr/share/nginx/html;
|
||||
|
||||
gzip on;
|
||||
gzip_vary on;
|
||||
gzip_proxied any;
|
||||
gzip_comp_level 6;
|
||||
gzip_buffers 16 8k;
|
||||
gzip_http_version 1.1;
|
||||
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript image/svg+xml image/x-icon;
|
||||
|
||||
add_header Strict-Transport-Security "max-age=31536000" always;
|
||||
|
||||
# SPA.
|
||||
# Try static files, then fall back to index.html.
|
||||
location / {
|
||||
try_files $uri /index.html;
|
||||
}
|
||||
|
||||
# Build files.
|
||||
# New builds produce hashed filenames, so these should be cached heavily.
|
||||
location /packs {
|
||||
add_header Cache-Control "public, max-age=31536000, immutable";
|
||||
add_header Strict-Transport-Security "max-age=31536000" always;
|
||||
}
|
||||
|
||||
# Return 404 on API routes so Soapbox knows what to do.
|
||||
location /api {
|
||||
add_header Content-Type "application/json";
|
||||
return 404 '{"error": "Not implemented"}';
|
||||
}
|
||||
|
||||
# ServiceWorker: don't cache.
|
||||
location = /sw.js {
|
||||
add_header Cache-Control "public, max-age=0";
|
||||
add_header Strict-Transport-Security "max-age=31536000" always;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue