From 93bfe5f59b837a152ea51d968bbec940c51662ae Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Fri, 9 Sep 2022 16:39:21 +0100 Subject: [PATCH] Use dockerfile for production The static buildpack is deprecated, and this is a lot easier --- .buildpacks | 2 -- .dockerignore | 1 + .gitlab-ci.yml | 2 +- Dockerfile | 13 +++++++++++++ static.json | 4 ---- 5 files changed, 15 insertions(+), 7 deletions(-) delete mode 100644 .buildpacks create mode 120000 .dockerignore create mode 100644 Dockerfile delete mode 100644 static.json diff --git a/.buildpacks b/.buildpacks deleted file mode 100644 index 1d188d9..0000000 --- a/.buildpacks +++ /dev/null @@ -1,2 +0,0 @@ -https://github.com/heroku/heroku-buildpack-nodejs -https://github.com/heroku/heroku-buildpack-static diff --git a/.dockerignore b/.dockerignore new file mode 120000 index 0000000..3e4e48b --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +.gitignore \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7e580d7..c3b637d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,7 +3,7 @@ stages: - deploy static: - image: node:alpine + image: node:slim stage: build cache: key: ${CI_COMMIT_REF_SLUG} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ddf523f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM node:slim as build + +ENV NODE_ENV=production + +COPY package.json package-lock.json ./ +RUN npm ci --no-audit --progress=false --omit=dev + +COPY . . +RUN npm run build + +FROM theorangeone/website-server:latest + +COPY --from=build ./public /srv diff --git a/static.json b/static.json deleted file mode 100644 index 1ebadb0..0000000 --- a/static.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "root": "public/", - "clean_urls": true -}