Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove turbo #11

Merged
merged 7 commits into from
Oct 15, 2024
Merged
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
24 changes: 0 additions & 24 deletions .github/workflows/container-tefca-viewer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,30 +50,6 @@ jobs:
working-directory: ./containers/${{env.CONTAINER}} # Navigate to your Node.js app directory
run: npm test

build-container:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Check Out Changes
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build ${{ env.CONTAINER }} Container
uses: docker/build-push-action@v3
with:
context: .
file: ./containers/${{ env.CONTAINER }}/Dockerfile
push: false
cache-from: type=gha
cache-to: type=gha,mode=max

playwright-tests:
timeout-minutes: 10
runs-on: ubuntu-latest
Expand Down
51 changes: 0 additions & 51 deletions .github/workflows/package-shared-resources.yaml

This file was deleted.

55 changes: 16 additions & 39 deletions containers/tefca-viewer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,16 @@
FROM node:18-alpine AS base

FROM base AS builder
# Install necessary packages for building
FROM base AS installer

RUN apk update
RUN apk add --no-cache libc6-compat
RUN apk add --no-cache bash curl

# Set working directory
WORKDIR /app
RUN npm i -g turbo
COPY . .
ENV TURBO_TELEMETRY_DISABLED=1
RUN turbo prune tefca-viewer --docker

# Add lockfile and package.json's of isolated subworkspace
FROM base AS installer
RUN apk update
RUN apk add --no-cache libc6-compat
WORKDIR /app

ENV FLYWAY_VERSION=10.19.0

# Add bash to enable running Flyway
RUN apk add --no-cache bash curl

# Install Flyway and remove JRE directory to force flyway to use the openjdk11 version in the runner
ENV FLYWAY_VERSION=10.19.0
RUN curl -L https://repo1.maven.org/maven2/org/flywaydb/flyway-commandline/${FLYWAY_VERSION}/flyway-commandline-${FLYWAY_VERSION}-linux-x64.tar.gz -o flyway.tar.gz \
&& tar -zxvf flyway.tar.gz \
&& mv flyway-${FLYWAY_VERSION} /flyway \
Expand All @@ -32,19 +19,10 @@ RUN curl -L https://repo1.maven.org/maven2/org/flywaydb/flyway-commandline/${FLY
&& rm -rf /flyway/jre \
&& chmod +x /flyway/flyway

# First install the dependencies
COPY .gitignore .gitignore
COPY --from=builder /app/out/json/ .
COPY --from=builder /app/out/package-lock.json ./package-lock.json
RUN npm i

# Build the project
COPY --from=builder /app/out/full/ .
COPY turbo.json turbo.json
ENV NEXT_TELEMETRY_DISABLED=1
ENV TURBO_TELEMETRY_DISABLED=1

RUN npx turbo build --filter=tefca-viewer...
RUN npm ci
RUN npm run build

# Final stage for running the app
FROM base AS runner
Expand All @@ -64,26 +42,25 @@ RUN adduser --system --uid 1001 nextjs
USER nextjs

# Set hostname to localhost
ENV HOSTNAME "0.0.0.0"
ENV HOSTNAME="0.0.0.0"

# Copy necessary app files
COPY --from=installer /app/containers/tefca-viewer/next.config.js .
COPY --from=installer /app/containers/tefca-viewer/package.json .
COPY --from=installer /app/containers/tefca-viewer/flyway/conf/flyway.conf /flyway/conf/flyway.conf
COPY --from=installer /app/containers/tefca-viewer/flyway/sql /flyway/sql
COPY --from=installer /app/next.config.js .
COPY --from=installer /app/package.json .
COPY --from=installer /app/flyway/conf/flyway.conf ../flyway/conf/flyway.conf
COPY --from=installer /app/flyway/sql ../flyway/sql

# Automatically leverage output traces to reduce image size
COPY --from=installer --chown=nextjs:nodejs /app/containers/tefca-viewer/.next/standalone ./
COPY --from=installer --chown=nextjs:nodejs /app/containers/tefca-viewer/.next/static ./containers/tefca-viewer/.next/static
COPY --from=installer --chown=nextjs:nodejs /app/containers/tefca-viewer/public ./containers/tefca-viewer/public

COPY --from=installer --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=installer --chown=nextjs:nodejs /app/.next/static ./.next/static
COPY --from=installer --chown=nextjs:nodejs /app/public ./public
RUN ls -R
# Set environment variables for Flyway and Node.js telemetry
ENV TURBO_TELEMETRY_DISABLED=1
ENV NEXT_TELEMETRY_DISABLED=1

# Set JAVA_HOME to the OpenJDK version installed by apk for Flyway
ENV JAVA_HOME=/usr/lib/jvm/default-jvm
# Add the OpenJDK to the PATH so the java command is available for Flways
ENV PATH=$JAVA_HOME/bin:$PATH

CMD ["sh", "-c","flyway -configFiles=/flyway/conf/flyway.conf -schemas=public -connectRetries=60 migrate && echo done with flyway && node containers/tefca-viewer/server.js"]
CMD ["sh", "-c","flyway -configFiles=../flyway/conf/flyway.conf -schemas=public -connectRetries=60 migrate && echo done with flyway && node server.js"]
1 change: 1 addition & 0 deletions containers/tefca-viewer/docker-compose-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ services:
flyway:
image: flyway/flyway:10.16-alpine
command: -configFiles=/flyway/conf/flyway.conf -schemas=public -connectRetries=60 migrate
platform: linux/amd64
volumes:
- ./flyway/sql:/flyway/sql
- ./flyway/conf/flyway.conf:/flyway/conf/flyway.conf
Expand Down
4 changes: 2 additions & 2 deletions containers/tefca-viewer/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ services:
tefca-viewer:
platform: linux/amd64
build:
context: ../../
dockerfile: ./containers/tefca-viewer/Dockerfile
context: .
dockerfile: Dockerfile
tty: true
ports:
- "3000:3000"
Expand Down
Loading