simplify and optimize dockerfile (ref #14)
This commit is contained in:
parent
7703f42054
commit
37b82c8614
3 changed files with 14 additions and 42 deletions
|
@ -1 +1,3 @@
|
||||||
node_modules
|
node_modules
|
||||||
|
.git
|
||||||
|
dist
|
|
@ -1,37 +0,0 @@
|
||||||
image: framasoft/vuefs:latest
|
|
||||||
stages:
|
|
||||||
- deploy
|
|
||||||
|
|
||||||
pages:
|
|
||||||
stage: deploy
|
|
||||||
script:
|
|
||||||
- yarn install --pure-lockfile
|
|
||||||
- npm run build
|
|
||||||
- rm -r public/ && mv dist/ public/
|
|
||||||
artifacts:
|
|
||||||
paths:
|
|
||||||
- public
|
|
||||||
cache:
|
|
||||||
paths:
|
|
||||||
- node_modules/
|
|
||||||
|
|
||||||
production:
|
|
||||||
stage: deploy
|
|
||||||
script:
|
|
||||||
- yarn install --pure-lockfile
|
|
||||||
- npm run build
|
|
||||||
- rm -r public/ && mv dist/ public/
|
|
||||||
- mkdir "${HOME}/.ssh"
|
|
||||||
- chmod 700 "${HOME}/.ssh"
|
|
||||||
- echo -e "${DEPLOYEMENT_KNOWN_HOSTS}" > ${HOME}/.ssh/known_hosts;
|
|
||||||
- eval `ssh-agent -s`
|
|
||||||
- ssh-add <(echo "${DEPLOYEMENT_KEY}" | base64 --decode -i);
|
|
||||||
- cd public && echo "put -r ." | sftp ${DEPLOYEMENT_USER}@${DEPLOYEMENT_HOST}:../../web;
|
|
||||||
only:
|
|
||||||
refs:
|
|
||||||
- master
|
|
||||||
variables:
|
|
||||||
- $DEPLOYEMENT_KEY
|
|
||||||
- $DEPLOYEMENT_KNOWN_HOSTS
|
|
||||||
- $DEPLOYEMENT_USER
|
|
||||||
- $DEPLOYEMENT_HOST
|
|
|
@ -1,4 +1,4 @@
|
||||||
FROM node:10-buster-slim as build-stage
|
FROM node:13-alpine as build-stage
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
@ -6,12 +6,19 @@ COPY package.json .
|
||||||
RUN yarn install --pure-lockfile \
|
RUN yarn install --pure-lockfile \
|
||||||
&& yarn cache clean
|
&& yarn cache clean
|
||||||
|
|
||||||
# TODO: copy only the required files here
|
COPY src/ src/
|
||||||
COPY . .
|
COPY public/ public/
|
||||||
|
COPY yarn.lock .
|
||||||
|
COPY .eslintrc.js .
|
||||||
|
|
||||||
|
# TODO: the build works fine with only the above files, does that mean we can delete everything else?
|
||||||
|
|
||||||
|
#COPY vue.config.js .
|
||||||
|
#COPY postcss.config.js .
|
||||||
|
#COPY .eslintrc .
|
||||||
|
|
||||||
RUN yarn run build
|
RUN yarn run build
|
||||||
|
|
||||||
|
|
||||||
FROM nginx as production-stage
|
FROM nginx as production-stage
|
||||||
RUN mkdir /app
|
RUN mkdir /app
|
||||||
COPY --from=build-stage /app/dist /app
|
COPY --from=build-stage /app/dist /app
|
||||||
|
|
Loading…
Reference in a new issue