-
Notifications
You must be signed in to change notification settings - Fork 12
Docker Hub Image #37
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
Docker Hub Image #37
Conversation
cc0a42c
to
61c8f37
Compare
Anyone reading this has enough Docker experience/knowledge to be able to review this PR? Any and all help would be most appreciated! 🙏 |
I prefer standalone docker files, i.e. reduces build steps and errors on the end user side but this is not needed for this project IMHO I would suggest using this My DockerfileFROM alpine:latest AS appBuild
LABEL maintainer="Peponi <[email protected]>" \
description="will run the Armadietto NodeJS web service (a RemoteStorageJS backend)"
ARG PROJECT_NAME="armadietto"
ARG PORT="8000"
ARG PKG_MANAGER="yarn"
ARG INSTALL_COMMAND="yarn global add"
ARG CONFIG_PATH_CERTS="/etc/letsencrypt/live/example.com/"
ARG CONFIG_PATH_STORAGE="/usr/share/armadietto"
ENV PROJECT_NAME=$PROJECT_NAME
RUN set -e;\
apk add \
curl \
git \
nodejs \
$PKG_MANAGER; \
mkdir /opt/armadietto; \
mkdir -m 0700 /$CONFIG_PATH_STORAGE; \
mkdir -m 0700 /$CONFIG_PATH_CERTS; \
$INSTALL_COMMAND $PROJECT_NAME; \
apk del git $PKG_MANAGER; \
adduser -u 6582 -HD $PROJECT_NAME;
COPY config.json /etc/armadietto.conf.json
VOLUME $CONFIG_PATH_STORAGE $CONFIG_PATH_CERTS
USER $PROJECT_NAME
WORKDIR ~
EXPOSE $PORT
CMD $PROJECT_NAME -c /etc/armadietto.conf.json
HEALTHCHECK CMD curl --fail http://127.0.0.1:$PORT/ || exit 1
### Install ###
#
# BUILD:
#
# default for amd64 architecture
#
# > docker build -t armadietto:latest .
# > docker build -t --build-arg PKG_MANAGER="npm" --build-arg INSTALL_COMMAND="npm i -g" armadietto:latest .
#
# RUN:
#
# > docker run --rm -p 8000:8000 rarmadietto:latest
#
# INFO: config.json needs to be byside the Dockerfile
#
# {
# "allow_signup": true,
# "storage_path": "/usr/share/armadietto",
# "cache_views": true,
# "http": {
# "host": "0.0.0.0",
# "port": 8000
# },
# "https": {
# "enable": false,
# "force": false,
# "port": 4443,
# "cert": "/etc/letsencrypt/live/example.com/cert.pem",
# "key": "/etc/letsencrypt/live/example.com/privkey.pem"
# },
# "basePath": ""
# }
#
### e2e testimage sizeEPOSITORY TAG IMAGE ID CREATED SIZE
armadietto peponi 9a84b73851eb 21 minutes ago 52.4MB
armadietto bytesnz 9829e4ad797b About an hour ago 118MB
security scan with trivy ✘ ~/Code/private/DockerFiles/armadietto docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v cache:/root/.cache/ aquasec/trivy armadietto:peponi
2021-05-23T09:21:40.833Z INFO Detected OS: alpine
2021-05-23T09:21:40.833Z INFO Detecting Alpine vulnerabilities...
2021-05-23T09:21:40.836Z INFO Number of PL dependency files: 1
2021-05-23T09:21:40.836Z INFO Detecting yarn vulnerabilities...
armadietto:peponi (alpine 3.13.5)
=================================
Total: 0 (UNKNOWN: 0, LOW: 0, MEDIUM: 0, HIGH: 0, CRITICAL: 0)
usr/local/share/.config/yarn/global/yarn.lock
=============================================
Total: 0 (UNKNOWN: 0, LOW: 0, MEDIUM: 0, HIGH: 0, CRITICAL: 0)
|
I just created a Maybe someone more experienced wants access to the RS team there? The free/community plan allows 2 more accounts to be added... Edit: considering that we're stuck on GitHub for now, would it also make sense to consider GitHub's own Docker registry for publishing this? Seems to me like Docker Hub is rather crippled on free plans. |
Cool. Looks good. Will integrate some of the stuff with the MR. The reason I went for using copy instead of yarn install is for integrating with github actions I - it would need to be published to npm before the docker image is created, but that's doable. I think it is good to have a docker image as well as it makes it super easy to deploy. |
We may want to utilize GitHub actions to do the final build/push to docker hub as well. I'd be in favour of remaining on docker hub, but if we want we can always push the image to multiple locations. |
👍 The MR has a template Github Action for building docker images, but it will need some tweaking. |
@bytesnz Did you find some time to integrate the things you wanted by any chance? No pressure, just making sure the PR doesn't go stale... |
@raucao I did start making changes and looking at it. I unfortunately ran out of time before going on a trip. I was going to merge the two dockerfiles and add testing to the action from peponi. I can do this at the start of Sep (long trip without a laptop). |
0bbb030
to
2b7fffd
Compare
Sorry about the delay. Have done a bit of merging between the two Dockerfiles:
For the github actions job, would be good to add an e2e test run to it as well, but would require a bit of test |
6354401
to
0ed6413
Compare
@bytesnz, was testing this a bit. Pulled your branch and...
But it exits right away with So I went into the image:
And running the linked Are we certain we can start the process like that? I've only started it as a library as per Would love to get this out and build on top of it. I see there are about 15k downloads of armadietto on docker-hub from various providers, would be nice to get this official one out 👍. |
Hey @JakubNer. Hmm, that's weird. Just tried running through the build process again and no issues for me (commands below). Is the image bytesnz/armadietto:latest working for you (is built off this repo? git clone https://github.com/bytesnz/armadietto
cd armadietto/
git checkout add-dockerfile
docker build -t remotestorage/armadietto:latest -f ./docker/Dockerfile .
docker run -p 8000:8000 --name armadietto remotestorage/armadietto:latest |
@bytesnz, indeed when I pull your image ( My own build fails like I mentioned. I did build off of the right place:
Just rebuilt it locally, same error. Weird. |
@bytesnz, I'm puzzled. I checked your docker-hub (https://hub.docker.com/r/bytesnz/armadietto/tags) and the image that runs for me is the image the git actions built and pushed last Octo (https://github.com/bytesnz/armadietto/actions/runs/1385063021) which is the same commit as of this PR and your tip-of-tree in your branch. So I don't understand why the linked What always works is simply removing the link on line 44 of the
I wonder if the difference is my host. I'm building on Windows in PowerShell. I don't see how that should make a difference though. |
I thought it might help if someone else tested this to confirm, so I tried the instructions from #37 (comment) on Arch Linux, and it worked without issues. However, if it works on Windows without the symlink (which I also have no idea how to explain), I guess forgoing it in favor of using the full path in the final command wouldn't hurt anyone. |
@JakubNer oooo that is weird. If you shell into your created docker image does the link exist and does it point to where it should?
I'm also curious to know what happens when you try and create a symbolic link in it
But yes agreed, if the full path works, we should just switch it to that. |
Indeed it exists but produces the same
Relinking works and lists in |
@bytesnz What's the status of the open tasks here? I see some unchecked ones about GitHub Actions, which I assume is about automatically building new images upon merging or for releases, right? |
In terms of the tasks:
|
Cool, thanks. Not sure I understand the problem with the tests. There's already a working Action for that. Shouldn't they each do their own thing and simply kick off other Actions depending on success? I don't really know much about GitHub Actions, but pipelines composed of different workflows are pretty standard in CI these days. Edit: what I mean by that is that the process should be something like: "test & lint" -> "publish npm package" -> "build docker image" -> "publish docker image" As we don't have a good process for automatic versioning, these steps would probably not apply for every merge per se. The |
So far as I can tell, this PR could still be merged as-is. It would be nice to merge in https://github.com/bytesnz/armadietto/pull/7/files first, though. |
@bytesnz Could you have a look at @DougReeder's PR to your repo? |
reviewed and merged 👍 |
Now we just need to merge master into this, to ensure we won't lose any of the changes to the submitBtn and documentation. |
- Fix healthcheck - Switch back to using local files for creation instead of global install - Use build container for installing node modules - Remove docs from Dockerfile
* Rewrite docker action to: * Run on all pushes * Only publish on a tag put * Run security tests * Split flow into multiple jobs * Change CMD to file instead of symlink Co-authored-by: Jakub Ner <[email protected]>
Make aquasec check error when issue found, but allow job to pass
- Use npm instead of yarn - Add a log directory - Update to the latest example config
098ddaf
to
a0d703b
Compare
Everyone's concerns appear to have been addressed, so I will merge this in a week, if no one objects. |
Just starting to add remote-storage (RS) to some projects I am working on, so am setting up my own RS server. I didn't see that you don't have a (recent) docker image on docker hub, so created a Dockerfile and a Github Action to build and publish one when a release is created.
The image is very basic - uses the node:lts-alpine docker image and the basic armadietto config (from
armadietto -e
). It exposes the armadietto http port to be used with a proxy.Are you interested in including this in the repo? Figure you could create an organisation on docker hub to publish it under.
Need to at least:
X-Forwarded-Host
is set)yarn global
/npm i -g