Skip to content

Commit

Permalink
[docker] fix published docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
sim51 committed Jan 28, 2025
1 parent e5b8128 commit 2cec07f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 17 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/deploy-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ jobs:
- name: Check out the repo
uses: actions/checkout@v4

- name: Install
run: npm install

- name: Build
run: npm run build
env:
BASE_URL: "./"

- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
Expand Down
18 changes: 4 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
FROM node:20
ARG BASE_URL="/"
FROM nginx:latest

RUN apt-get -qq update && apt-get -qqy install nginx && apt-get clean
COPY ./packages/gephi-lite/build/ /var/www/html/
COPY ./nginx.conf /etc/nginx/conf.d/default.conf

COPY . /opt/code
WORKDIR /opt/code
RUN npm install && npm cache clean --force
RUN npm run build
RUN rm /var/www/html/*
RUN cp -f nginx.conf /etc/nginx/sites-available/default
RUN cp -R build/* /var/www/html/

EXPOSE 80

CMD ["nginx", "-g", "daemon off;"]
EXPOSE 80
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,18 @@ Stops container and frees all the resources obtained by the container.

### Dockerfile for production

The Dockerfile provided in this repository is designed for **production**.
The Dockerfile provided in this repository is designed for **production**.
The application is build and then served by nginx, which its port is exposed by docker

* Build the image : `docker build -f Dockerfile -t gephi-lite .`
* Create & run a container : `docker run -p 80:80 gephi-lite`
- Build the project :

```
$> export BASE_URL="./"
$> npm run build
```

- Build the image : `docker build -f Dockerfile -t gephi-lite .`
- Create & run a container : `docker run -p 80:80 gephi-lite`

### Any custom `npm` command

Expand Down

0 comments on commit 2cec07f

Please sign in to comment.