Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docker-release.sh in order to build and push to Docker hub #463

Closed
wants to merge 4 commits into from
Closed

Add docker-release.sh in order to build and push to Docker hub #463

wants to merge 4 commits into from

Conversation

DavidHenryThoreau
Copy link
Contributor

@SamR1
Copy link
Owner

SamR1 commented Dec 23, 2023

Hi,

Thanks for the updated PR.

As the docker files present in this repository are just for evaluation (not suitable for production), it will build an image for evaluation only.

@DavidHenryThoreau
Copy link
Contributor Author

Right, but for production how do you plan to build the docker image ?

@SamR1
Copy link
Owner

SamR1 commented Jan 6, 2024

Hard to say, I have no experience deploying with Docker in production :/

@DavidHenryThoreau
Copy link
Contributor Author

@DavidHenryThoreau
Copy link
Contributor Author

It's possible to let GitHub build docker image automatically every time you merge on master branch.

You can create a GitHub action by using this link (I've made some test in my fork) :
https://github.com/SamR1/FitTrackee/new/master?filename=.github%2Fworkflows%2Fdocker-publish.yml&workflow_template=ci%2Fdocker-publish

@DavidHenryThoreau
Copy link
Contributor Author

@DavidHenryThoreau
Copy link
Contributor Author

Docker images are based on ubuntu, but size is bigger than GiB, there's a way to reduce, other docker's project are smaller

@jovandeginste
Copy link

I built them for my personal usage, with these changes, reducing the image sizes to:

  • fittrackee: 560MB
  • fittrackee_client: 357MB
diff --git a/.dockerignore b/.dockerignore
index db3149ba..24c43d49 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -10,3 +10,5 @@ docker-compose-dev.yml
 Makefile.custom.config
 *.log
 data
+fittrackee_client
+db
diff --git a/Dockerfile b/Dockerfile
index ac910520..9da0f2f5 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,4 @@
-FROM python:3.10
+FROM python:3.10-slim

 # set working directory
 RUN mkdir -p /usr/src/app
@@ -11,8 +11,8 @@ COPY . /usr/src/app
 ENV VIRTUAL_ENV=/opt/venv
 RUN python3 -m venv $VIRTUAL_ENV
 ENV PATH="$VIRTUAL_ENV/bin:$PATH"
-RUN pip install --upgrade pip
-RUN pip install poetry
+RUN pip install --no-cache-dir --upgrade pip
+RUN pip install --no-cache-dir poetry
 RUN . $VIRTUAL_ENV/bin/activate && poetry install --no-interaction --quiet

 # run fittrackee server
diff --git a/fittrackee_client/Dockerfile b/fittrackee_client/Dockerfile
index e1c9e5f3..9c929f89 100644
--- a/fittrackee_client/Dockerfile
+++ b/fittrackee_client/Dockerfile
@@ -1,9 +1,8 @@
-FROM node:18
+FROM node:18-alpine

 MAINTAINER SamR1@users.noreply.github.com

 # set working directory
-RUN mkdir /usr/src/app
 WORKDIR /usr/src/app

 # add `/usr/src/app/node_modules/.bin` to $PATH
@@ -18,7 +17,8 @@ ENV VITE_APP_API_URL $VITE_APP_API_URL
 # install dependencies
 COPY package.json /usr/src/app/package.json
 COPY yarn.lock /usr/src/app/yarn.lock
-RUN yarn install --silent
+RUN yarn install --silent && yarn cache clean --force
+RUN npm run build

 # copy source
 COPY . /usr/src/app/

@DavidHenryThoreau DavidHenryThoreau closed this by deleting the head repository May 2, 2024
DavidHenryThoreau pushed a commit to DavidHenryThoreau/FitTrackee that referenced this pull request May 15, 2024
DavidHenryThoreau pushed a commit to DavidHenryThoreau/FitTrackee that referenced this pull request May 15, 2024
DavidHenryThoreau pushed a commit to DavidHenryThoreau/FitTrackee that referenced this pull request May 15, 2024
DavidHenryThoreau pushed a commit to DavidHenryThoreau/FitTrackee that referenced this pull request May 15, 2024
DavidHenryThoreau pushed a commit to DavidHenryThoreau/FitTrackee that referenced this pull request May 15, 2024
DavidHenryThoreau pushed a commit to DavidHenryThoreau/FitTrackee that referenced this pull request May 15, 2024
DavidHenryThoreau pushed a commit to DavidHenryThoreau/FitTrackee that referenced this pull request May 15, 2024
DavidHenryThoreau pushed a commit to DavidHenryThoreau/FitTrackee that referenced this pull request May 15, 2024
DavidHenryThoreau pushed a commit to DavidHenryThoreau/FitTrackee that referenced this pull request May 15, 2024
DavidHenryThoreau pushed a commit to DavidHenryThoreau/FitTrackee that referenced this pull request May 15, 2024
DavidHenryThoreau pushed a commit to DavidHenryThoreau/FitTrackee that referenced this pull request May 15, 2024
DavidHenryThoreau pushed a commit to DavidHenryThoreau/FitTrackee that referenced this pull request May 15, 2024
DavidHenryThoreau pushed a commit to DavidHenryThoreau/FitTrackee that referenced this pull request May 15, 2024
DavidHenryThoreau pushed a commit to DavidHenryThoreau/FitTrackee that referenced this pull request May 15, 2024
DavidHenryThoreau pushed a commit to DavidHenryThoreau/FitTrackee that referenced this pull request May 15, 2024
DavidHenryThoreau pushed a commit to DavidHenryThoreau/FitTrackee that referenced this pull request May 15, 2024
DavidHenryThoreau pushed a commit to DavidHenryThoreau/FitTrackee that referenced this pull request May 15, 2024
DavidHenryThoreau pushed a commit to DavidHenryThoreau/FitTrackee that referenced this pull request May 15, 2024
DavidHenryThoreau pushed a commit to DavidHenryThoreau/FitTrackee that referenced this pull request May 15, 2024
DavidHenryThoreau pushed a commit to DavidHenryThoreau/FitTrackee that referenced this pull request May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants