Add file volume to the docker image
This commit is contained in:
parent
37efd5cb49
commit
9dc419e854
2 changed files with 22 additions and 4 deletions
14
Dockerfile
14
Dockerfile
|
@ -15,22 +15,28 @@ RUN apk --no-cache add build-base git
|
||||||
COPY . ${GOPATH}/src/code.vikunja.io/api
|
COPY . ${GOPATH}/src/code.vikunja.io/api
|
||||||
WORKDIR ${GOPATH}/src/code.vikunja.io/api
|
WORKDIR ${GOPATH}/src/code.vikunja.io/api
|
||||||
|
|
||||||
#Checkout version if set
|
# Checkout version if set
|
||||||
RUN if [ -n "${VIKUNJA_VERSION}" ]; then git checkout "${VIKUNJA_VERSION}"; fi \
|
RUN if [ -n "${VIKUNJA_VERSION}" ]; then git checkout "${VIKUNJA_VERSION}"; fi \
|
||||||
&& make clean generate build
|
&& make clean generate build
|
||||||
|
|
||||||
###################
|
###################
|
||||||
# The actual image
|
# The actual image
|
||||||
# Note: I wanted to use the scratch image here, but unfortunatly the go-sqlite bindings require cgo and
|
# Note: I wanted to use the scratch image here, but unfortunatly the go-sqlite bindings require cgo and
|
||||||
# for whatever reason, the container would not start when I compiled the image without cgo.
|
# because of this, the container would not start when I compiled the image without cgo.
|
||||||
FROM alpine:3.9
|
FROM alpine:3.9
|
||||||
LABEL maintainer="maintainers@vikunja.io"
|
LABEL maintainer="maintainers@vikunja.io"
|
||||||
|
|
||||||
WORKDIR /app/vikunja/
|
WORKDIR /app/vikunja/
|
||||||
COPY --from=build-env /go/src/code.vikunja.io/api/vikunja .
|
COPY --from=build-env /go/src/code.vikunja.io/api/vikunja .
|
||||||
RUN chown nobody:nogroup -R /app/vikunja
|
RUN adduser -S -D vikunja -h /app/vikunja -H \
|
||||||
|
&& chown vikunja -R /app/vikunja
|
||||||
ENV VIKUNJA_SERVICE_ROOTPATH=/app/vikunja/
|
ENV VIKUNJA_SERVICE_ROOTPATH=/app/vikunja/
|
||||||
|
|
||||||
USER nobody:nogroup
|
# Files permissions
|
||||||
|
RUN mkdir /app/vikunja/files && \
|
||||||
|
chown -R vikunja /app/vikunja/files
|
||||||
|
VOLUME /app/vikunja/files
|
||||||
|
|
||||||
|
USER vikunja
|
||||||
CMD ["/app/vikunja/vikunja"]
|
CMD ["/app/vikunja/vikunja"]
|
||||||
EXPOSE 3456
|
EXPOSE 3456
|
||||||
|
|
12
REST-Tests/attachment_from_scratch.sh
Executable file
12
REST-Tests/attachment_from_scratch.sh
Executable file
|
@ -0,0 +1,12 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
curl -X POST http://localhost:3456/api/v1/register -H 'Content-Type: application/json' -d '{"username":"demo","password":"demo","email":"demo@vikunja.io"}'
|
||||||
|
BEARER=`curl -X POST -H 'Content-Type: application/json' -d '{"username": "demo", "password":"demo"}' localhost:3456/api/v1/login | jq -r '.token'`
|
||||||
|
|
||||||
|
echo "Bearer: $BEARER"
|
||||||
|
|
||||||
|
curl -X POST localhost:3456/api/v1/tokenTest -H "Authorization: Bearer $BEARER"
|
||||||
|
|
||||||
|
curl -X PUT localhost:3456/api/v1/namespaces/1/lists -H 'Content-Type: application/json' -H "Authorization: Bearer $BEARER" -d '{"title":"lorem"}'
|
||||||
|
curl -X PUT localhost:3456/api/v1/lists/1 -H 'Content-Type: application/json' -H "Authorization: Bearer $BEARER" -d '{"text":"lorem"}'
|
||||||
|
curl -X PUT -H "Authorization: Bearer $BEARER" localhost:3456/api/v1/tasks/1/attachments -F 'files=@/home/konrad/Pictures/Wallpaper/greg-rakozy-_Q4mepyyjMw-unsplash.jpg'
|
Loading…
Reference in a new issue