Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 23 additions & 48 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,65 +5,40 @@
##

# Build project
FROM node:16.13-alpine3.13 AS builder
FROM node:20-alpine AS builder

RUN set -x \
# Change node uid/gid
&& apk --no-cache add shadow \
&& groupmod -g 1001 node \
&& usermod -u 1001 -g 1001 node
# Define non-root user
USER node

RUN set -x \
# Add user
&& addgroup --gid 1000 app \
&& adduser --disabled-password \
--gecos '' \
--ingroup app \
--home /app \
--uid 1000 \
app

COPY --chown=app:app . /app

USER app
# Set working directory
WORKDIR /app
COPY --chown=node:node . .

ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true

RUN set -x \
# Build
&& PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true npm ci \
&& npm run build
# Clean install and build
RUN npm ci --omit=optional && npm run build

# Main image
FROM node:16.13-alpine3.13
FROM node:20-alpine AS runtime

RUN set -x \
# Change node uid/gid
&& apk --no-cache add shadow \
&& groupmod -g 1001 node \
&& usermod -u 1001 -g 1001 node
USER node
WORKDIR /app

RUN set -x \
# Add user
&& addgroup --gid 1000 app \
&& adduser --disabled-password \
--gecos '' \
--ingroup app \
--home /app \
--uid 1000 \
app
COPY --chown=node:node package*.json ./
COPY --chown=node:node app app
COPY --chown=node:node common common
COPY --chown=node:node public/locales public/locales
COPY --chown=node:node server server
COPY --chown=node:node --from=builder /app/dist dist

USER app
WORKDIR /app
# Install production dependencies only
RUN npm ci --omit=dev && npm cache clean --force

COPY --chown=app:app package*.json ./
COPY --chown=app:app app app
COPY --chown=app:app common common
COPY --chown=app:app public/locales public/locales
COPY --chown=app:app server server
COPY --chown=app:app --from=builder /app/dist dist
# Required configuration for some Node.js libraries
RUN mkdir -p ~/.config/configstore

RUN npm ci --production && npm cache clean --force
RUN mkdir -p /app/.config/configstore
# Create a symlink to the version file
RUN ln -s dist/version.json version.json

ENV PORT=1443
Expand Down
10 changes: 10 additions & 0 deletions app/ui/archiveTile.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,15 @@ function archiveDetails(translate, archive) {
}

module.exports = function(state, emit, archive) {
const link = html`
<input
type="text"
id="share-url"
value="${archive.url}"
readonly="readonly"
class="block w-full my-4 border-default rounded-lg leading-loose h-12 px-2 py-1 dark:bg-grey-80"
>
`;
const copyOrShare =
state.capabilities.share || platform() === 'android'
? html`
Expand Down Expand Up @@ -281,6 +290,7 @@ module.exports = function(state, emit, archive) {
</div>
${archiveDetails(state.translate, archive)}
<hr class="w-full border-t my-4 dark:border-grey-70" />
${link}
<div class="flex justify-between w-full">
${dl} ${copyOrShare}
</div>
Expand Down
27 changes: 27 additions & 0 deletions compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
services:
send-redis:
image: redis:alpine
restart: always
expose:
- "6379"
networks:
- net-send
send-web:
user: node
build: .
ports:
- "80:1443"
depends_on:
- send-redis
networks:
- net-send
environment:
- NODE_ENV=production
- BASE_URL=http://localhost
- FILE_DIR=/app/uploads
- REDIS_HOST=send-redis
- REDIS_PORT=6379

networks:
net-send:
driver: bridge
19 changes: 0 additions & 19 deletions docker-compose.yml

This file was deleted.