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

Use alpine base #21

Closed
wants to merge 3 commits into from
Closed

Use alpine base #21

wants to merge 3 commits into from

Conversation

jukie
Copy link

@jukie jukie commented Oct 28, 2018

This is to fix #19
I took what @bradmccormack wrote but made DYNAMODB_VERSION a build arg instead, this way you can support multiple versions in your CI system without modifying the Dockerfile.

@dwmkerr
Copy link
Owner

dwmkerr commented Oct 29, 2018

This is excellent @JukieWalsh! Would you be able to add a note to the README on how to use the arg, with an example or two? If you are busy I can do it in a day or two!

@jukie
Copy link
Author

jukie commented Oct 29, 2018

sure, I'll add the commits now

@jukie
Copy link
Author

jukie commented Oct 29, 2018

Might want to take a look at tweaking the makefile to support both parameters too. Unfortunately it won't be very elegant though...

@jukie
Copy link
Author

jukie commented Oct 31, 2018

Thoughts?

@dwmkerr dwmkerr self-assigned this Nov 29, 2018
Copy link

@mberlanda mberlanda left a comment

Choose a reason for hiding this comment

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

Hey! I have been testing your Dockerfile aginst the latest (dynamodb_local_2018-04-11.tar.gz)

At the first action I take, I am getting the following error:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x000000000000d7c6, pid=1, tid=0x00007f4499c09ae8
#
# JRE version: OpenJDK Runtime Environment (8.0_191-b12) (build 1.8.0_191-b12)
# Java VM: OpenJDK 64-Bit Server VM (25.191-b12 mixed mode linux-amd64 compressed oops)
# Derivative: IcedTea 3.10.0
# Distribution: Custom build (Thu Jan 10 09:44:25 UTC 2019)
# Problematic frame:
# C  0x000000000000d7c6
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /opt/dynamodb/hs_err_pid1.log
#
# If you would like to submit a bug report, please include
# instructions on how to reproduce the bug and visit:
#   http://icedtea.classpath.org/bugzilla
#

Did you face the same?

@mberlanda
Copy link

mberlanda commented Jan 23, 2019

I got the same even forcing the versions described in the issue:

FROM openjdk:8u171-alpine3.8
ENV DYNAMODB_VERSION "2018-04-11"

Error:

Initializing DynamoDB Local with the following configuration:
Port:	8000
InMemory:	false
DbPath:	null
SharedDb:	false
shouldDelayTransientStatuses:	false
CorsParams:	*

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x000000000000d7c6, pid=1, tid=0x00007f6afe9eaae8
#
# JRE version: OpenJDK Runtime Environment (8.0_171-b11) (build 1.8.0_171-b11)
# Java VM: OpenJDK 64-Bit Server VM (25.171-b11 mixed mode linux-amd64 compressed oops)
# Derivative: IcedTea 3.8.0
# Distribution: Custom build (Wed Jun 13 18:28:11 UTC 2018)
# Problematic frame:
# C  0x000000000000d7c6
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /opt/dynamodb/hs_err_pid1.log
#
# If you would like to submit a bug report, please include
# instructions on how to reproduce the bug and visit:
#   http://icedtea.classpath.org/bugzilla
#

# Use JDK 7. I tried alpine, but all calls to dynamo then fail silently...
# FROM openjdk:7-jre-alpine
FROM openjdk:7
FROM openjdk:8-jre-alpine

Choose a reason for hiding this comment

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

I could not make it work locally but it worked using slim tags

Image sizes:

  • regular ~510 mb
  • slim ~240 mb
  • alpine ~120 mb

Slim will not optimize the image size but it could be already considered an improvement

Copy link
Author

Choose a reason for hiding this comment

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

This fell off my radar, I'll take a look now and try either getting it to work reliably or else use the slim tags.

Copy link
Author

Choose a reason for hiding this comment

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

Could you give an example of what you ran to get the above error?
I also found this which may explain why: uber/h3-java#25

Choose a reason for hiding this comment

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

👋 @jukie I was getting this kind of message

Copy link
Owner

Choose a reason for hiding this comment

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

Let's go for slim then, still an improvement and I love the build arg so want to get the changes in!

@@ -1,11 +1,12 @@
# Create the docker images locally. If a BUILD_NUM is provided, we will also
# create an image with the tag BUILD_NUM.
# Specify a specific dynamodb version by changing the DYNAMODB_VERSION=latest build flag as desired
Copy link
Owner

Choose a reason for hiding this comment

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

I think a trick we can use here is this:

DYNAMODB_VERSION ?= latest
build:
    docker build -t dwmkerr/dynamodb:latest --build-arg DYNAMODB_VERSION=$(DYNAMODB_VERSION)
    # etc...

This way there's not even any need to change the makefile, the caller can just do:

DYNAMODB_VERSION=1.2.3 make build

Or even:

make build DYNAMODB_VERSION=1.2.3 

It's a really nice syntax - if the variable is not specified, the default latest is use. This is an excellent approach for CI systems - if you have a specific version in mind you can just set it as an env var and the makefile will just pick it up automatically.

(Nice reference here: https://adamcod.es/2016/11/15/makefile-variables.html)

# Use JDK 7. I tried alpine, but all calls to dynamo then fail silently...
# FROM openjdk:7-jre-alpine
FROM openjdk:7
FROM openjdk:8-jre-alpine
Copy link
Owner

Choose a reason for hiding this comment

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

Let's go for slim then, still an improvement and I love the build arg so want to get the changes in!

@jukie jukie closed this Feb 14, 2023
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.

Update for Alpine base
3 participants