-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding docker setup for automerge-sync-server
- Loading branch information
Showing
6 changed files
with
104 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Create and publish Docker image | ||
|
||
on: | ||
# release: | ||
# types: [published] | ||
push: | ||
branches: | ||
- main | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
# https://docs.docker.com/build/ci/github-actions/multi-platform/ | ||
|
||
jobs: | ||
build-and-push-image: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Log in to the Container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
push: true | ||
platforms: linux/amd64,linux/arm64 | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# syntax=docker/dockerfile:1.4 | ||
FROM node:lts-slim AS development | ||
|
||
LABEL org.opencontainers.image.source=https://github.com/heckj/automerge-repo-sync-server | ||
LABEL org.opencontainers.image.description="A debugging/test instance of automerge-repo-sync-server" | ||
LABEL org.opencontainers.image.licenses=MIT | ||
|
||
# Create app directory | ||
WORKDIR /usr/src/app | ||
|
||
COPY package.json ./package.json | ||
RUN yarn install | ||
|
||
COPY . . | ||
|
||
EXPOSE 3030 | ||
# NODE_ENV=dev DEBUG=* node ./src/index.js | ||
ENV NODE_ENV=dev | ||
ENV DEBUG=* | ||
CMD [ "node", "./src/index.js" ] | ||
|
||
FROM development as dev-envs | ||
RUN <<EOF | ||
apt-get update | ||
apt-get install -y --no-install-recommends git | ||
EOF | ||
|
||
RUN <<EOF | ||
useradd -s /bin/bash -m vscode | ||
groupadd docker | ||
usermod -aG docker vscode | ||
EOF | ||
|
||
HEALTHCHECK CMD curl --fail http://localhost:3030 || exit 1 | ||
|
||
# install Docker tools (cli, buildx, compose) | ||
# COPY --from=gloursdocker/docker / / | ||
|
||
CMD [ "node", "./src/index.js" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters