Skip to content

Commit

Permalink
Build assets
Browse files Browse the repository at this point in the history
  • Loading branch information
yguedidi committed Aug 15, 2023
1 parent abb6a98 commit d93c2a4
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,30 @@
ARG WALLABAG_VERSION=2.6.2

FROM golang:alpine as builder

# envsubst from gettext can not replace env vars with default values
# this package is not available for ARM32 and we have to build it from source code
# flag -ldflags "-s -w" produces a smaller executable
RUN go install -ldflags "-s -w" -v github.com/a8m/envsubst/cmd/envsubst@v1.3.0

FROM node:16-alpine3.18 as assets

ARG WALLABAG_VERSION

RUN set -ex \
&& apk add --no-cache curl \
&& curl -L -o /tmp/wallabag.tar.gz https://github.com/wallabag/wallabag/archive/$WALLABAG_VERSION.tar.gz \
&& tar xvf /tmp/wallabag.tar.gz -C /tmp \
&& mv /tmp/wallabag-$WALLABAG_VERSION /tmp/wallabag \
&& cd /tmp/wallabag \
&& yarn install \
&& yarn build:prod

FROM alpine:3.18

COPY --from=builder /go/bin/envsubst /usr/bin/envsubst

ARG WALLABAG_VERSION=2.6.2
ARG WALLABAG_VERSION

RUN set -ex \
&& apk add --no-cache \
Expand Down Expand Up @@ -69,11 +84,14 @@ RUN set -ex \
&& rm -rf /tmp/wallabag* \
&& cd /var/www/wallabag \
&& mkdir data/assets \
&& rm -fr web/wallassets \
&& envsubst < /etc/wallabag/parameters.template.yml > app/config/parameters.yml \
&& SYMFONY_ENV=prod composer install --no-dev -o --prefer-dist --no-progress \
&& rm -rf /root/.composer/* /var/www/wallabag/var/cache/* /var/www/wallabag/var/logs/* /var/www/wallabag/var/sessions/* \
&& chown -R nobody:nobody /var/www/wallabag

COPY --from=assets /tmp/wallabag/web/wallassets /var/www/wallabag/web/wallassets

ENV PATH="${PATH}:/var/www/wallabag/bin"

# Set console entry path
Expand Down

0 comments on commit d93c2a4

Please sign in to comment.