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

Setup docker for project #3

Merged
merged 1 commit into from May 4, 2020
Merged

Setup docker for project #3

merged 1 commit into from May 4, 2020

Conversation

ascii-dev
Copy link
Contributor

@ascii-dev ascii-dev commented Apr 29, 2020

Description

Sets up docker to aid in development and deployment.

Fixes #172525811

Type of change

Please delete options that are not relevant.

  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation

@ascii-dev ascii-dev force-pushed the setup_docker branch 3 times, most recently from 4713d3e to 6c1261a Compare April 29, 2020 09:38
@ascii-dev ascii-dev self-assigned this Apr 29, 2020
@ascii-dev ascii-dev force-pushed the setup_docker branch 2 times, most recently from 64fbcba to 5b74b33 Compare April 29, 2020 09:50
@ascii-dev ascii-dev force-pushed the setup_docker branch 2 times, most recently from 3051d1b to 5ac9764 Compare April 29, 2020 13:00
Copy link
Member

@kilemensi kilemensi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 @ascii-dev


Is it possible to do a mutli-stage build (https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#use-multi-stage-builds)? I prefer smaller final image sizes.

entrypoint.sh Outdated Show resolved Hide resolved
Dockerfile Outdated Show resolved Hide resolved
@ascii-dev ascii-dev force-pushed the setup_docker branch 3 times, most recently from c0999aa to dd467bd Compare April 30, 2020 09:31
COPY --from=builder /root/.local /root/.local
COPY --from=builder /app /app
WORKDIR app
RUN apt-get update && apt-get install libpq-dev -y
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to repeat this libpq-dev package because apparently psycopg2 needs it both to install and to run and I couldn't find a way to copy the packages from the build image to the app image. All in all, I was able to bring the final image down to 275MB from around 599MB. I'll keep doing more research concerning this libpq-dev package and definitely raise an patch pr to fix it when I get a fix.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird but cool @ascii-dev i.e. would have assumed dev packages are only needed to build binaries & hence we should have been able to just copy the built binaries into app image... but we're short on time right now so 300MB reduction is good enough. 🚀

COPY --from=builder /root/.local /root/.local
COPY --from=builder /app /app
WORKDIR app
RUN apt-get update && apt-get install libpq-dev -y
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird but cool @ascii-dev i.e. would have assumed dev packages are only needed to build binaries & hence we should have been able to just copy the built binaries into app image... but we're short on time right now so 300MB reduction is good enough. 🚀

@ascii-dev ascii-dev merged commit 8726082 into master May 4, 2020
@ascii-dev ascii-dev added this to the v0.1 milestone May 19, 2020
@kilemensi kilemensi deleted the setup_docker branch July 28, 2021 05:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants