Skip to content

Commit

Permalink
refactor(docker): install deps inside dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
gempain committed May 25, 2021
1 parent 3181cab commit 10e31f7
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 9 deletions.
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
*
!server/node_modules
!server/package.json
!server/package-lock.json
!server/migrate-mongo-config.js
!server/migrations
!server/build
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,7 @@ jobs:
- name: "build"
run: npm run build
- name: "docker build"
run: |
rm -rf server/node_modules
npm ci --production --prefix server
docker build --pull -t $TMP_DOCKER_IMAGE -f ./Dockerfile .
npm ci
run: docker build --pull -t $TMP_DOCKER_IMAGE -f ./Dockerfile .
- name: "release"
if: ${{ github.ref == 'refs/heads/latest' || github.ref == 'refs/heads/beta' }}
run: |
Expand Down
9 changes: 6 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ LABEL maintainer="meli.sh"

RUN apk add --no-cache \
caddy \
nodejs
nodejs \
npm

# entrypoint
COPY ./docker/entrypoint.sh /entrypoint.sh
Expand All @@ -15,12 +16,15 @@ COPY ./docker/caddy-config.json /etc/caddy/config.json
COPY ./ui/build /app/ui
# server
COPY ./server/build /app/server
COPY ./server/node_modules /app/server/node_modules
COPY ./server/package.json /app/server
COPY ./server/package-lock.json /app/server
COPY ./server/migrate-mongo-config.js /app/server
COPY ./server/migrations /app/server/migrations

WORKDIR /app/server

RUN npm ci --production

ENV MELI_URL_INTERNAL=http://localhost:3001
ENV MELI_UI_DIR=/app/ui
ENV MELI_POSTHOG_ENABLED="true"
Expand All @@ -36,6 +40,5 @@ EXPOSE 80
EXPOSE 443
EXPOSE 2019


ENTRYPOINT ["/entrypoint.sh"]
CMD ["node", "index.js"]
29 changes: 29 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
version: "3"

services:

meli:
image: tmp
ports:
- 127.0.0.1:8000:80
environment:
# no trailing slash !
MELI_URL: http://localhost:8000
MELI_MONGO_URI: mongodb://mongo:27017/meli
MELI_JWT_SECRET: changeMe
MELI_USER: user
MELI_PASSWORD: changeMe
MELI_HTTPS_AUTO: "false"
volumes:
- ./tmp/sites:/sites
- ./tmp/files:/files
- ./tmp/caddy/data:/data
- ./tmp/caddy/config:/config
depends_on:
- mongo

mongo:
image: mongo:4.2-bionic
restart: unless-stopped
volumes:
- ./tmp/mongo:/data/db

0 comments on commit 10e31f7

Please sign in to comment.