Skip to content
Snippets Groups Projects
Commit b7beebae authored by Marco Wettstein's avatar Marco Wettstein
Browse files

feat: faster docker build

feat: upgrade to node 14
feat: use alpine instead of normal image
fix: remove .git from docker image
parent 7d6a03f5
No related branches found
No related tags found
1 merge request!6F/speedup docker
Pipeline #88323 passed
...@@ -5,16 +5,30 @@ include: ...@@ -5,16 +5,30 @@ include:
.ensureDocker: &ensureDocker | .ensureDocker: &ensureDocker |
function ensureDockerfile() { function ensureDockerfile() {
if [ ! -f .dockerignore ]; then
cat > .dockerignore <<EOF
node_modules
.git
EOF
fi
if [ ! -f Dockerfile ]; then if [ ! -f Dockerfile ]; then
echo "Creating Dockerfile" echo "Creating Dockerfile"
cat > Dockerfile <<EOF cat > Dockerfile <<EOF
FROM node:12.18 FROM node:14-alpine
ADD . /app
WORKDIR /app WORKDIR /app
RUN yarn --production RUN apk add --no-cache git
EXPOSE 8080 COPY --chown=node:node package.json yarn.lock ./
RUN chown -R node:node .
USER node
RUN yarn --frozen-lockfile --production=true --ignore-scripts
COPY --chown=node:node . .
RUN yarn --frozen-lockfile --production=true
EOF EOF
fi fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment