Skip to content

Commit

Permalink
Merge pull request #124 from lvthillo/upgrade-api-dockerfile
Browse files Browse the repository at this point in the history
feat: upgrade dockerfile and replace deprecated node14
  • Loading branch information
karpikpl authored Jan 2, 2025
2 parents 1b0468b + 80ae96a commit 4ab0acf
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions api.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
# Stage 1: Build the Vue.js application
FROM node:14 AS build-stage
FROM node:23 AS build-stage

USER node
WORKDIR /app

COPY --chown=1000:1000 package*.json ./
RUN npm install
COPY --chown=1000:1000 . .
# this will tokenize the app
RUN npm run build

# Stage 2: Prepare the Node.js API
FROM node:14 AS api-stage
FROM node:23 AS api-stage

WORKDIR /api

# Copy package.json and other necessary files for the API
COPY --chown=1000:1000 api/package*.json ./
RUN npm install \
&& chown -R 1000:1000 /api
RUN npm install && \
chown -R 1000:1000 /api && \
apt-get update && \
apt-get install -y --no-install-recommends gettext-base && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Copy the rest of your API source code
COPY --chown=1000:1000 api/ .
Expand All @@ -25,14 +30,11 @@ COPY --chown=1000:1000 api/ .
COPY --chown=1000:1000 --from=build-stage /app/dist /api/public
COPY --chown=1000:1000 --from=build-stage /app/dist/assets/app-config.js /api/app-config.template.js

# install gettext-base for envsubst
RUN apt-get update && apt-get install -y gettext-base

# Expose the port your API will run on
EXPOSE 3000

# Command to run your API (and serve your Vue.js app)
RUN chmod +x /api/docker-entrypoint.api/entrypoint.sh

USER node
ENTRYPOINT ["/api/docker-entrypoint.api/entrypoint.sh"]
ENTRYPOINT ["/api/docker-entrypoint.api/entrypoint.sh"]

0 comments on commit 4ab0acf

Please sign in to comment.