Skip to content

Commit

Permalink
Added sass to docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
petergrlica committed Nov 3, 2023
1 parent a384efa commit 7acdf18
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ env:
NODE_VERSION: 16

RELEASE_BASE_URL: "https://releases.cortezaproject.org/files"
SASS_VERSION: 1.69.5

jobs:
server-test:
Expand Down Expand Up @@ -433,6 +434,7 @@ jobs:
run: |
docker build \
--build-arg "VERSION=${{ env.DOCKER_IMAGE_TAG }}" \
--build-arg "SASS_VERSION=${{ env.SASS_VERSION }}" \
--tag ${{ matrix.image }}:${{ env.DOCKER_IMAGE_TAG }} \
${{ matrix.context }}
Expand Down
11 changes: 9 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ FROM alpine:3 as build-stage

# use docker build --build-arg VERSION=2021.9.0 .
ARG VERSION=2022.9.0
ARG SASS_VERSION=1.69.5
ARG SERVER_VERSION=${VERSION}
ARG WEBAPP_VERSION=${VERSION}
ARG CORTEZA_SERVER_PATH=https://releases.cortezaproject.org/files/corteza-server-${SERVER_VERSION}-linux-amd64.tar.gz
ARG CORTEZA_WEBAPP_PATH=https://releases.cortezaproject.org/files/corteza-webapp-${WEBAPP_VERSION}.tar.gz
ARG SASS_URL=https://github.com/sass/dart-sass/releases/download/${SASS_VERSION}/dart-sass-${SASS_VERSION}-linux-x64.tar.gz

RUN mkdir /tmp/server
RUN mkdir /tmp/webapp
Expand All @@ -15,6 +17,7 @@ ADD $CORTEZA_SERVER_PATH /tmp/server
ADD $CORTEZA_WEBAPP_PATH /tmp/webapp

RUN apk update && apk add --no-cache file
RUN apk add curl

RUN file "/tmp/server/$(basename $CORTEZA_SERVER_PATH)" | grep -q 'gzip' && \
tar zxvf "/tmp/server/$(basename $CORTEZA_SERVER_PATH)" -C / || \
Expand All @@ -30,6 +33,10 @@ RUN file "/tmp/webapp/$(basename $CORTEZA_WEBAPP_PATH)" | grep -q 'gzip' && \
mkdir /corteza/webapp && tar zxvf "/tmp/webapp/$(basename $CORTEZA_WEBAPP_PATH)" -C /corteza/webapp || \
cp -a "/tmp/webapp" /corteza/webapp

WORKDIR /tmp

RUN curl -sOL $SASS_URL
RUN tar -xzf dart-sass-${SASS_VERSION}-linux-x64.tar.gz

# deploy-stage
FROM ubuntu:20.04
Expand All @@ -45,13 +52,14 @@ ENV CORREDOR_ADDR "corredor:80"
ENV HTTP_ADDR "0.0.0.0:80"
ENV HTTP_WEBAPP_ENABLED "true"
ENV HTTP_WEBAPP_BASE_DIR "/corteza/webapp"
ENV PATH "/corteza/bin:${PATH}"
ENV PATH "/opt/dart-sass:/corteza/bin:${PATH}"

WORKDIR /corteza

VOLUME /data

COPY --from=build-stage /corteza ./
COPY --from=build-stage /tmp/dart-sass /opt/dart-sass

HEALTHCHECK --interval=30s --start-period=1m --timeout=30s --retries=3 \
CMD curl --silent --fail --fail-early http://127.0.0.1:80/healthcheck || exit 1
Expand All @@ -61,4 +69,3 @@ EXPOSE 80
ENTRYPOINT ["./bin/corteza-server"]

CMD ["serve-api"]

10 changes: 9 additions & 1 deletion server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ RUN apt-get -y update \
&& rm -rf /var/lib/apt/lists/*

ARG VERSION=2022.9
ARG SASS_VERSION=1.69.5
ARG SERVER_VERSION=${VERSION}
ARG CORTEZA_SERVER_PATH=https://releases.cortezaproject.org/files/corteza-server-${SERVER_VERSION}-linux-amd64.tar.gz
ARG SASS_URL=https://github.com/sass/dart-sass/releases/download/${SASS_VERSION}/dart-sass-${SASS_VERSION}-linux-x64.tar.gz

RUN mkdir /tmp/server
ADD $CORTEZA_SERVER_PATH /tmp/server

Expand All @@ -19,6 +22,11 @@ RUN tar -zxvf "/tmp/server/$(basename $CORTEZA_SERVER_PATH)" -C / && \
rm -rf "/tmp/server" && \
mv /corteza-server /corteza

WORKDIR /opt

RUN curl -sOL $SASS_URL
RUN tar -xzf dart-sass-${SASS_VERSION}-linux-x64.tar.gz

WORKDIR /corteza

HEALTHCHECK --interval=30s --start-period=1m --timeout=30s --retries=3 \
Expand All @@ -28,7 +36,7 @@ ENV STORAGE_PATH "/data"
ENV CORREDOR_ADDR "corredor:80"
ENV HTTP_ADDR "0.0.0.0:80"
ENV HTTP_WEBAPP_ENABLED "false"
ENV PATH "/corteza/bin:${PATH}"
ENV PATH "/opt/dart-sass:/corteza/bin:${PATH}"

EXPOSE 80

Expand Down

0 comments on commit 7acdf18

Please sign in to comment.