Skip to content

Commit 1d7b33f

Browse files
author
Denis Gordeev
committed
Rewrite the verdaccio Dockerfile
1 parent dbdd328 commit 1d7b33f

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

verdaccio/Dockerfile

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,10 @@
1-
FROM ubuntu as preparation
1+
FROM ubuntu
22

33
RUN apt-get update && \
4-
apt-get -y install apache2-utils
4+
apt-get -y install apache2-utils curl && \
5+
curl -sL https://deb.nodesource.com/setup_14.x | bash && \
6+
apt-get -y install nodejs
57

68
COPY . .
79

8-
RUN ./create-config.sh
9-
RUN ./create-user.sh
10-
11-
FROM node:14
12-
13-
WORKDIR "/home/node/verdaccio"
14-
15-
COPY package.json .
16-
COPY package-lock.json .
17-
COPY --from=preparation config.yaml ./conf/
18-
COPY --from=preparation htpasswd ./storage/
19-
20-
RUN npm install
21-
22-
ENTRYPOINT ["npm", "start", "--", "--config", "./conf/config.yaml"]
10+
ENTRYPOINT ["./start.sh"]

verdaccio/create-config.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#! /bin/bash
22

3+
mkdir conf
4+
35
sed \
46
-e 's,${NPM_AUTH_TOKEN},'"${NPM_AUTH_TOKEN}"',g' \
57
-e 's,${PORT},'"${PORT}"',g' \
6-
template.yml >config.yaml
8+
template.yml >./conf/config.yaml

verdaccio/create-user.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
#! /bin/bash
22

3-
htpasswd -b -c htpasswd ${NPM_LOGIN} ${NPM_PASSWORD}
3+
mkdir storage
4+
5+
htpasswd -b -c ./storage/htpasswd ${NPM_LOGIN} ${NPM_PASSWORD}

verdaccio/start.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#! /bin/bash
2+
3+
./create-config.sh
4+
./create-user.sh
5+
6+
npm install
7+
8+
npm start -- --config ./conf/config.yaml

0 commit comments

Comments
 (0)